【发布时间】:2016-11-19 02:24:54
【问题描述】:
我在 UISearchController 中有一个 UISearchBar,当被点击时它会向右推。
下面是我用来在 UIViewController 中设置搜索栏的代码
//Set self object to recieve all the updates of UISearchResultsController
self.searchResultsUpdater = self;
//Hide navigation bar during presentation of the UISearchController.
self.hidesNavigationBarDuringPresentation = YES;
//set delegates to UISearchBar and UISearchController
self.delegate = self;
self.searchBar.delegate = self;
//Set scope bars that does not exist
self.searchBar.scopeButtonTitles = [NSArray array];
//Some additional settings that can be configured
self.context.definesPresentationContext = YES;
self.dimsBackgroundDuringPresentation = NO;
[self.searchBar sizeToFit];
self.tableView.tableHeaderView = self.searchBar;
self.context.edgesForExtendedLayout = UIRectEdgeTop;
self.searchBar.clipsToBounds = YES;
所有其他控制器都在工作,很好。它只是一个控制器,它一直以一种奇怪的方式行事。
该应用程序同时支持 iPhone 和 iPad,搜索似乎在 iPhone 上运行良好,但在 iPad 上却表现得很神秘。
【问题讨论】:
标签: ios objective-c ipad uisearchbar