Change the uitableview footer height in landscape mode

Discussion in 'iPhone/iPad Programming' started by franium, Jan 14, 2011.

  1. franium, Jan 14, 2011
    Last edited: Jan 14, 2011

    macrumors member

    Joined:
    Nov 18, 2010
    #1
    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
    Code:
    - (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:

    Code:
    - (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
    Code:
    (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration
    Any suggestions?
    Thanks in advance,
    Fran
     
  2. macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    Several UITableView methods cause it to reload sections. reloadData, reloadSections:withRowAnimation: and probably beginUpdates/endUpdates. Call one of these when the device rotates.
     
  3. thread starter macrumors member

    Joined:
    Nov 18, 2010
    #3
    Thanks! I resolved using reloadData :)
     

Share This Page