显示searchController

时间:2019-03-06 17:56:17

标签: ios objective-c

当我将设备旋转至横向时,searchBar看起来非常糟糕。我该如何解决?

enter image description here

- (void)initializeSearchController {

    // Setup the Search Controller
    self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
    self.searchController.searchResultsUpdater = self;
    self.searchController.obscuresBackgroundDuringPresentation = false;
    self.searchController.searchBar.placeholder = @"Search";
    self.navigationItem.searchController = self.searchController;
    self.definesPresentationContext = true;
    [self.searchController.searchBar sizeToFit];
    self.navigationItem.hidesSearchBarWhenScrolling = false;
    // Setup the Scope Bar
    self.searchController.searchBar.scopeButtonTitles = @[@"One",@"Two")];
    self.searchController.searchBar.delegate = self;
    self.searchController.hidesNavigationBarDuringPresentation = true;

}

0 个答案:

没有答案