PDA

View Full Version : Change the uitableview footer height in landscape mode




franium
Jan 14, 2011, 03:21 AM
Hi everyone,

I have a grouped UITableView with some sections (with an header title). I want to add a footer to the first section, so I use

- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section {

switch (section) {
case 0:
return @"some lines of text...........bla bla bla bla bla etc etc");
break;
default:
return nil;
break;
}
}


My problem is with the landscape mode. There is a quite big space between the footer and the header of the next section, so I change the footer height programatically in this way:


- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
switch (section) {
case 0:
if (UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
return 85.0;
} else {
return 75.0;
}
break;
default:
return 10;
break;
}
}


But how can I change the footer height in
(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration
Any suggestions?
Thanks in advance,
Fran



PhoneyDeveloper
Jan 14, 2011, 09:30 AM
Several UITableView methods cause it to reload sections. reloadData, reloadSections:withRowAnimation: and probably beginUpdates/endUpdates. Call one of these when the device rotates.

franium
Jan 14, 2011, 02:04 PM
Several UITableView methods cause it to reload sections. reloadData, reloadSections:withRowAnimation: and probably beginUpdates/endUpdates. Call one of these when the device rotates.

Thanks! I resolved using reloadData :)