I'm using UISearchBar
in my app, with showsScopeBar=YES
. When running under iOS8 (both in the simulator and on a device) the scope bar is hidden and the search bar's height remains at 44 instead of the expected 88. Using the new view debugger in Xcode 6 I can see that the scope bar is actually present, but remains hidden behind the text field.
The only way I've found so far is to manually set the search bar's height to 88, which of course is a terrible hack.
Am I missing some documented incompatibility, or is this a bug?
I ran into this problem too. After searching on Apples developer forum I found this thread: https://devforums.apple.com/thread/235803?start=0&tstart=0
And apparently the SearchBar don't automatically does a sizeToFit when it's supposed too. So it's height stays at 44 instead of adjusting to the scope buttons. The bug is not fixed in the iOS8 GM.
I did a simple [self.searchBar sizeToFit] in my viewWillAppear: and that solved it.
This issue is occurring in the iOS 8 release version as well. I added these 2 lines in my viewWillAppear: and that solved it.
- (void)adjustSearchBarToShowScopeBar{
[self.searchBar sizeToFit];
self.tableView.tableHeaderView = self.searchBar;
}
Just adding [self.searchBar sizeToFit] was covering up my tableview's first row.
Just refreshing the tableview header fixed the issue perfectly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With