iOS 6 UISearchBar cancel button in landscape did not displayed, but displayed in portrait on iPad

425 Views Asked by At

I have a UISearchDisplayController above a UITableView. My code works on iPhone iOS 6/7 and iPad iOS 7.

But on iPad with iOS 6, I have this result in landscape Landscape

and in portrait Portrait

Where is the cancel button?

I use

- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
    [self.searchController setActive:YES animated:YES];
}

to be sure that the controller is activated.

Have you an idea?

1

There are 1 best solutions below

1
On

Use:

UIView *searchBarView = [[UIView alloc] initWithFrame:[searchBar bounds]];
[searchBarView addSubview:searchBar];
self.navigationItem.titleView = searchBarView;