Search Results TableView's position doesn't work properly

155 Views Asked by At

When I start to type in the searchbar my search results tableview goes 20 px top of the searchbar. Where can I set the frame's position fixed in my code? In viewdidload or searchDisplayControllerWillBeginSearch,[self.searchDisplayController.searchResultsTableView setFrame:CGRectMake(0, self.searchbar.frame.origin.y, 320, 466)]; doesn't work.

Thank you.

First 2 images, searchbar stays in the same position. But search result tableview goes up and stays there still after canceling the search. After canceling the search the searchbar goes top of the resulttableview of searchbar.

enter image description here


enter image description here


enter image description here

2

There are 2 best solutions below

0
On BEST ANSWER

It was because of I selected bottom line in the autosizing in xib. So I choose top line in autosizing and It worked.

9
On

try this .

you need to set delta y and delta height of tableview from xib for iOS 7.