Hide UITableView search bar by default

I know this is a duplicate question, but I tried all the answers I found,

eg: iPhone: hide UITableView search bar by default

but when i try this:

[self.tableView setContentOffset:CGPointMake(0, 44)];

      

there is a flicker on top (navigation position) when clicking on this view manager.

since at the beginning my table number is 0, so I cannot use this:

[yourTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];

      

+3


source to share


1 answer


There is a flicker because you don't have enough rows to fill the size of the tableView's content and iOS will automatically adjust the insertion in this situation.

In this case, the method scrollToRowAtIndexPath

does not work.



The only solution I have gotten so far is to insert enough blank cells into the tableView. This way the content is large enough that iOS won't set the insert.

Here's a Swift example . While this is in Swift, the idea is the same. You can easily translate it to Objective-C.

0


source







All Articles