【发布时间】:2014-01-30 21:33:44
【问题描述】:
我创建了一个非常简单的演示应用程序来测试automaticallyAdjustsScrollViewInsets 的功能,但是 tableView 的最后一个单元格被我的标签栏覆盖了。
我的 AppDelegate 代码:
UITabBarController *tabControl = [[UITabBarController alloc] init];
tabControl.tabBar.translucent = YES;
testViewController *test = [[testViewController alloc] init];
[tabControl setViewControllers:@[test]];
[self.window setRootViewController:tabControl];
我的 testViewController(UITableViewController 的子类)代码:
- (void)viewDidLoad
{
[super viewDidLoad];
self.automaticallyAdjustsScrollViewInsets = YES;
self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds];
self.tableView.dataSource = self;
self.tableView.scrollIndicatorInsets = self.tableView.contentInset;
//[self.view addSubview:self.tableView];
// Do any additional setup after loading the view.
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 20;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@""];
cell.textLabel.text = @"test";
return cell;
}
这是 iOS 7 中的错误吗?如果没有,我做错了什么?
【问题讨论】:
标签: ios objective-c ios7 uiscrollview uitabbar