Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tab Bar covers TableView cells in iOS7

I have a custom tableViewController that I'm adding to a TabBarController with

self.tabBarController.viewControllers = [NSArray arrayWithObjects:someOtherViewController, customTableViewController, nil]; self.tabBarController.selectedIndex = 1; 

The issue I'm having is that the last 1.5 tableViewCells are being covered by the tab bar at the bottom of the screen on an iPhone 4 running iOS7. When I use the iOS Simulator - iPhone Retina (4-inch) / iOS 7.0 the issue still exists.

What is the correct way to make the tableView line up with the top of the tabBar at the bottom of the screen without using 'magic numbers'?

like image 395
JuJoDi Avatar asked Oct 11 '13 19:10

JuJoDi


People also ask

What is tab bar in iOS?

A TabBar is a control that is used to display and configure one or more bar button items in a tab bar for selecting between different subtasks, views, or modes in the iOS application. The TabBar is used in association with the TabBarController to present the list of tabs in the application.

What is tab bar in Swift?

The tab bar interface displays tabs at the bottom of the window for selecting between the different modes and for displaying the views for that mode. This class is generally used as-is, but may also be subclassed. Each tab of a tab bar controller interface is associated with a custom view controller.


1 Answers

Try this for your CustomViewController:

- (void)viewDidLoad {     [super viewDidLoad];      UIEdgeInsets adjustForTabbarInsets = UIEdgeInsetsMake(0, 0, CGRectGetHeight(self.tabBarController.tabBar.frame), 0);     self.scrollView.contentInset = adjustForTabbarInsets;     self.scrollView.scrollIndicatorInsets = adjustForTabbarInsets; } 
like image 98
dariaa Avatar answered Sep 23 '22 06:09

dariaa