I\'m developing an application based on the Tab Bar application preset. In one of the tabs I have a table view showing a lot of data, but half the last cell in the table vie
This did the trick here (within Interface Builder):
There are a couple of solutions for this.
1.) Assuming that you are using translucent tool bars, you have to make the tool bars opaque.
2.) If you are using StoryBoard and you are putting a TableView inside your ViewController, assuming it's a ViewController and not a TableViewController.
3.) You can manually add padding/spacing.
if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
{
self.edgesForExtendedLayout = UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars = YES;
self.automaticallyAdjustsScrollViewInsets = NO;
}
or
UIEdgeInsets insets = UIEdgeInsetsMake (0,sizeOfTableView - sizeOfTabBar, 0, 0);
self.tableView.contentInset = inset;
self.tableView.scrollIndicatorInsets = inset;
Hope this helps & Happy coding!
For me it was just that the table view in UIViewController didn't have any constraints, once I pinned in to the edges of the view it fixed itself.
I just solved this problem by adding constant number... hard coding... How about finding threshold value fit to you?
I think you have a custom Tabbar, you need reset the height of Tabbar equal to the height of the background image of this Tabbar.
UITabBar * tabbar = self.tabBar ;
[tabbar setBackgroundImage:[UIImage imageNamed:@"image.png"]] ;
[tabbar setFrame:CGRectMake(0, 480 - imageHeight, 320, imageHeight)];
Swift 3:
This is what worked perfectly for me. This code not only stop the last cell showing behind the tab bar, but also pushes up the scroll indicator. Put the code in your viewDidLoad()
:
if let rect = self.navigationController?.tabBarController?.tabBar.frame {
let y = rect.size.height
tableView.contentInset = UIEdgeInsetsMake( 0, 0, y, 0)
tableView.scrollIndicatorInsets = UIEdgeInsetsMake(0, 0, y, 0)
}