How do I resize table view after resizing it's footer?

Posted by Pedro on Stack Overflow See other posts from Stack Overflow or by Pedro
Published on 2010-06-03T14:30:47Z Indexed on 2010/06/03 14:34 UTC
Read the original article Hit count: 221

Filed under:
|
|

I have a UITableView with header & footer added with code following the pattern shown in Apple's recipes example so the code for the footer is...

if (tableFooterView == nil) {
 [[NSBundle mainBundle] loadNibNamed:@"DetailFooterView" owner:self options:nil];
 self.tableView.tableFooterView = tableFooterView;
}

The footer NIB contains nothing more than a UITextView & I set text & resize with...

CGSize size = [footerText sizeWithFont:[footerTextView font] constrainedToSize:CGSizeMake(304.0, 500.0)];
CGRect frame = CGRectMake(8.0, 0.0, size.width, size.height + 24.0);

footerTextView.frame = frame;
footerTextView.text = footerText;

[tableFooterView sizeToFit];

That all works however I can't get the UITableView to resize around the resized footer. If I set the original size of the footer for any possible text I have a big whitespace in most cases. If I set it smaller then I can push the view up to see the whole text but it bounces back on release. I've tried [[self view] sizeToFit]; but that doesn't work. Can anyone fill me in?

Cheers & TIA, Pedro :)

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uitableview