Tab Bar 覆盖了 iOS7 中的 TableView 单元格 [英] Tab Bar covers TableView cells in iOS7
问题描述
我有一个自定义 tableViewController,我将它添加到 TabBarController
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;
我遇到的问题是最后 1.5 个 tableViewCells 被运行 iOS7 的 iPhone 4 屏幕底部的标签栏覆盖.当我使用 iOS 模拟器 - iPhone Retina(4 英寸)/iOS 7.0 时,问题仍然存在.
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.
在不使用幻数"的情况下,使 tableView 与屏幕底部的 tabBar 顶部对齐的正确方法是什么?
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'?
推荐答案
为您的 CustomViewController 试试这个:
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;
}
这篇关于Tab Bar 覆盖了 iOS7 中的 TableView 单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!