首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UISearchBar in UISearchController当被点击时滑向右边

UISearchBar in UISearchController当被点击时滑向右边
EN

Stack Overflow用户
提问于 2016-07-15 19:09:01
回答 1查看 126关注 0票数 0

我有一个UISearchBar在一个UISearchController里面,当点击它的时候,它会向右推。

--这是搜索栏处理初始设置的方式

下面是我用来在UIViewController中设置搜索栏的代码

代码语言:javascript
复制
 //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上却神秘地运行。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-07-15 20:13:30

我自己解决了这个问题。我要做的是:

代码语言:javascript
复制
self.definesPresentationContext = false;

一旦这个观点被驳回,就删除它

代码语言:javascript
复制
self.searchController.active = false;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38403507

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档