Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TableView content inset in UITabBarController

I have 4 UITableViewController in a UITabBarController. They all use the same UITableViewController class, but on the 3 last controllers, the tableView is not correctly displayed : the top of the tableView is displayed under the navigationBar whereas the first is correctly displayed

The first UITableViewController embedded in a UITabBarViewController (index 0)

The same UITableViewController at index 1, 2 and 3 :

I try to solve the problem by setting programmatically the tableView contentInset in "MCVigilanceSingleColorViewController" class (inherited from UITableViewController), but it is applied to my four controllers (then the tableView of my first UITableViewController has now a wrong frame...).

In the storyboard, my 4 UITableViewController use the same class too, and they are all the same : my 4 ViewControllers are exactly the same. The 2nd, 3th and 4th controllers are a "copy/paste" from the first (I just changed the barItemText). Then they all have the same options checked and unchecked. By the way, checking the option "underTopBard" have no effect on my displayed controllers. I juste don't understand why they are displayed differently.

Cay you help me please ? Thx.

like image 926
QLag Avatar asked Nov 11 '22 12:11

QLag


1 Answers

Embedding the UITableViewController in a UINavigationController fixes this issue for me. This is pretty easy from the Storyboard. Just select the UITableViewController, then go to Editor > Embed In > Navigation Controller.

like image 119
Caleb L Avatar answered Nov 15 '22 05:11

Caleb L