开发者

hide tableHeaderView after insert/delete operation in UITableView

I have UITableView with UISearchBar loca开发者_开发百科ted inside tableHeaderView I want to keep header view invisible until user scrolls up so I do:

self.tableView.contentOffset = CGPointMake(0, self.searchBar.frame.size.height);

My problem is that after I do any insert or delete (I use NSFetchedResultsController) UITableView scrolls to 0,0 and show up table header.

Is there a way to keep scrolling off after insert or delete operation is made ?


The contentOffset is analogous to the position from where you want the UIScrollView (which encompasses the UITableView) to begin. If your table view was more than a screen-worth of content, you'll notice that you'd still be able to scroll upwards to the tableViewHeader which you're trying to hide.

It sounds like you should instead play around with the contentInset (before and after an insert/delete action) to hide and display the tableViewHeader.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜