Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nested UITableViews no longer work in iOS7

I've got a nested table inside the first cell of another table. It worked great, until I recompiled for iOS7, and now the inner table's row selection events are no longer being handled by the inner table's delegate methods.

I'm stumped. Any ideas? Thanks!

like image 997
mph Avatar asked Sep 20 '13 20:09

mph


1 Answers

I use this technique very often and it still works in iOS 7. Keep in mind that because of how constraints work for scrollviews (in this case tableviews) you need the content of the inner tableview to define the height of it (I'm assuming the inner table is fixed so height = contentSize).

I usually extend UITableView for this purpose into something like this so that it works well with constraints in this scenario:

@implementation ExpandedTableView

- (void)reloadData
{
    [super reloadData];
    [self invalidateIntrinsicContentSize];
}

- (CGSize)intrinsicContentSize
{
    return self.contentSize;
}

@end

Also, check out my pod with some helpers to easily create dynamic height table cells: https://github.com/fer662/UITableViewHelper

like image 186
Fernando Mazzon Avatar answered Oct 14 '22 21:10

Fernando Mazzon