相关疑难解决方法(0)

automaticAdjustsScrollViewInsets不起作用

我已经创建了一个非常简单的演示应用来测试其功能automaticallyAdjustsScrollViewInsets,但是我的标签栏覆盖了tableView的最后一个单元格.

我的AppDelegate代码:

UITabBarController *tabControl = [[UITabBarController alloc] init];
tabControl.tabBar.translucent = YES;
testViewController *test = [[testViewController alloc] init];
[tabControl setViewControllers:@[test]];

[self.window setRootViewController:tabControl];
Run Code Online (Sandbox Code Playgroud)

我的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"; …
Run Code Online (Sandbox Code Playgroud)

objective-c uiscrollview uitabbar ios ios7

29
推荐指数
3
解决办法
3万
查看次数

标签 统计

ios ×1

ios7 ×1

objective-c ×1

uiscrollview ×1

uitabbar ×1