Basically, I am trying to ensure that my visibility panel does not disappear.
Environment: iOS 7, storyboard, inside the view controller. I have a "search bar and display controller" and a separate table view (the search bar is not inside the table).
Inside the controller view.h
@property (nonatomic, strong) IBOutlet UISearchBar *candySearchBar;
Inside the .m view controller
@synthesize candySearchBar;
What I tried: inside a custom search class class
- (void) setShowsScopeBar:(BOOL) showsScopeBar { if ([self showsScopeBar] != showsScopeBar) { [super invalidateIntrinsicContentSize]; } [super setShowsScopeBar:showsScopeBar]; [super setShowsScopeBar: YES];
and
searchBarDidEndEditing
Same thing in the view controller, but then
- (void)viewDidLoad { [super viewDidLoad];
I hope my question is clear, I tried many solutions posted all over the Internet, most of them talk about the setshowsscopebar set, but it doesn't seem to work. The log output in setshowscopebar is 1, but the scope is still not displayed.
I still consider myself a novice in the code, an error can still be a novice error.
edit: another piece of code in the view controller, as you can see that I'm looking for a blind:
-(void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller{ self.searchDisplayController.searchBar.showsCancelButton = YES; self.searchDisplayController.searchBar.showsScopeBar = YES; controller.searchBar.showsScopeBar = TRUE; controller.searchBar.frame = CGRectMake(0, 149, 768, 88); UIButton *cancelButton; UIView *topView = self.searchDisplayController.searchBar.subviews[0]; for (UIView *subView in topView.subviews) { if ([subView isKindOfClass:NSClassFromString(@"UINavigationButton")]) { cancelButton = (UIButton*)subView; } } if (cancelButton) {