I have a UISearchBar (& UISearchDisplayController) inside the sidebar of the tableView that I created (see attached photo). This is visible when a button is clicked in my UINavigationBar. Inside my map controller, I have a UISegmentControl in the navigation bar that allows my user to switch between views (mapView and friendsMapView).
For some reason, the UISearchBar appears just in the sidebar when it is initially open. However, when I switch the segment control to switch to friendsMapView, and then back to mapView, my UISearchBar disappeared (see photo).
Any idea why this could be? I implemented above in StoryBoard. See below the code for the control segment (not sure if this helps):
.m
-(IBAction)segmentControl:(id)sender { UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UITableViewController *menuController; menuController = [storyBoard instantiateViewControllerWithIdentifier:@"neighbourMenu"]; self.title = @"Controller 1"; switch (self.segmentControl.selectedSegmentIndex) { case 0: [mapView setHidden:NO]; [friendsMapView setHidden:YES]; menuController = [storyBoard instantiateViewControllerWithIdentifier:@"neighbourMenu"]; break; case 1: //FRIENDS MAP VIEW menuController = [storyBoard instantiateViewControllerWithIdentifier:@"FriendMenu"]; // self.title = @"Item 1"; [mapView setHidden:YES]; [friendsMapView setHidden:NO]; //FRIENDS MAPVIEW LOCATION/ZOOM friendsMapView.delegate = self; self.locationManager = [[CLLocationManager alloc] init]; self.locationManager.delegate = self;
source share