vendredi 6 février 2015

How to properly inset a UITableView inside a nav and tab controller?


Vote count:

0




I have a navigation setup where at the top there is a UITabBarController. I then have a tab, which is instantiated by creating a UIViewController placed into a UINavigationController like so:



UIViewController *testVC = [UIViewController new]; // Has UITableView as subview
UINavigationController *testNavVC = [[UINavigationController alloc] initWithRootViewController:testVC];

[self setViewControllers:@[testNavVC]];


The problem that arrises is with the UITableView inside the testVC UIViewController. The table displays properly at the top and is correctly situated underneath the UINavController's nav bar. When you scroll the table view to the bottom, however, the final rows in the table view will be cut off at the bottom of the screen. I found out that I can set the bottom content inset to 100(value will differ based on row height) to correctly display the content. I don't feel like I should need to do that though, and am looking for a better solution.


How can I properly add a UITableView that is nested in this way?


As a side note this all works correctly when using a UITableViewController rather than a UIViewController with the added UITableView. In my case I am needing to use the latter option.



asked 2 mins ago







How to properly inset a UITableView inside a nav and tab controller?

Aucun commentaire:

Enregistrer un commentaire