Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-14-2011, 02:58 AM   #1 (permalink)
Registered Member
 
franium's Avatar
 
Join Date: Nov 2010
Posts: 68
franium is on a distinguished road
Default Change the uitableview footer height in landscape mode

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
If I use
Code:
self.tableView.sectionFooterHeight = 85.0;
it changes the footer height of all sections.
Any suggestions?
Thanks in advance,
Fran

Last edited by franium; 01-14-2011 at 04:09 AM. Reason: More details
franium is offline   Reply With Quote
Old 01-14-2011, 05:23 AM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

heightForHeaderInSection should be called when you switch from portrait to landscape and viceversa.

So what you should do is just
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];

and check orientation value to set the height.
__________________
dany_dev is offline   Reply With Quote
Old 01-14-2011, 05:26 AM   #3 (permalink)
Registered Member
 
franium's Avatar
 
Join Date: Nov 2010
Posts: 68
franium is on a distinguished road
Default

Quote:
Originally Posted by dany88 View Post
heightForHeaderInSection should be called when you switch from portrait to landscape and viceversa.

So what you should do is just
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];

and check orientation value to set the height.
Really not... so I reload the tableview in
Code:
(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration
and in heightForHeaderInSection I check for the orientation and set the height properly. Now it works.
franium is offline   Reply With Quote
Reply

Bookmarks

Tags
footer, grouped, uitableview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 369
10 members and 359 guests
7twenty7, blueorb, dre, iAppDeveloper, iGamesDev, Mah6447, Morrisone, mottdog, sacha1996, Touchmint
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,667
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, host number one
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:36 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0