简体   繁体   中英

Scroll to bottom of UITableView on iOS 7?

My view controller has a UITableView, but it isn't the main view. 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. Is there a way to do this?

You can adjust the UITableView's 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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