简体   繁体   English

在iOS 7上滚动到UITableView的底部?

[英]Scroll to bottom of UITableView on iOS 7?

My view controller has a UITableView, but it isn't the main view. 我的视图控制器具有UITableView,但它不是主视图。 I find now that when the user tries to scroll to the bottom, the scroll view doesn't consider the height of the bottom bar. 现在我发现,当用户尝试滚动到底部时,滚动视图不会考虑底部栏的高度。

I could fix this by turning off Extend Edges: Under Bottom Bars , but that gets rid of the semi-transulecent effect. 我可以通过关闭“ 扩展边缘:在底部条形图下”来解决此问题,但这消除了半透明效果。 I'd rather manually add the extra height to the tableview. 我宁愿手动将额外的高度添加到tableview中。 Is there a way to do this? 有没有办法做到这一点?

You can adjust the UITableView's contentInset : 您可以调整UITableView的contentInset

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    UIEdgeInsets edges = _tableView.contentInset;
    edges.bottom = self.navigationController.toolbar.frame.size.height;
    _tableView.contentInset = edges;
}

Thanks to Michael above. 感谢上面的迈克尔。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM