UISearchDisplayDelegate 如何删除这个不透明视图?
我如何以编程方式从 UISearchDisplayController 显示/隐藏这个不透明视图?
可能在 searchDisplayControllerWillBeginSearch
或 searchDisplayControllerDidBeginSearch
我需要设置一些东西...但是什么?
谢谢。
how can i programmatically show/hide this opaque view from UISearchDisplayController?
Probably in searchDisplayControllerWillBeginSearch
or searchDisplayControllerDidBeginSearch
i need to set something... but what?
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用
UIKeyboardWillAppearNotification
临时解决。OpaqueView 是一个 alpha = 0.8 的UIControl。
我使用了这种ORRIBLE方法来临时解决问题......任何其他想法将不胜感激!
谢谢。
Temporary solved using
UIKeyboardWillAppearNotification
.OpaqueView is an UIControl with alpha = 0.8.
I used this ORRIBLE way to temporary fix problem.... any other idea will be appreciated!
thanks.
ELPSK给出的代码是当前的,但在 ios7及以上 中无效
在ios6和ios7中工作的代码如下
- 在ViewDidload中添加以下通知
在下面写入函数
注意:代码只有一个额外的条件
Code given by elpsk is current but will not work in iOS7 and above
Code working in both iOS6 and iOS7 is as below
- add below notification in viewDidLoad
Write below function
NOTE : Code just have one extra condition as in iOS7 UIControl class become UISearchDisplayControllerContainerView,
其他答案不适合我。这个对我来说适用于 iOS7 和 iOS8。
如果您不需要 iOS7 支持,请不要再使用 searchDisplayController,因为它已被弃用。对于 iOS8,请使用 UISearchController 和 dimsBackgroundDuringPresentation
属性
参考: https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UISearchController/index.html#//apple_ref/occ/instp/UISearchController/dimsBackgroundDuringPresentation
The other answers where not working for me. This one works for me on iOS7 and iOS8.
If you don't need support for iOS7 please don't use the searchDisplayController anymore because its deprecated. For iOS8 use the UISearchController and the dimsBackgroundDuringPresentation
Property
Ref: https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UISearchController/index.html#//apple_ref/occ/instp/UISearchController/dimsBackgroundDuringPresentation
嗯...快速回答。不太漂亮,但肯定有效
该视图是在您编写时显示的,所以我想您应该在 searchBarTextDidBeginEditing 中使用它。如果我错了,请在开始搜索或其他任何事情时使用它。
Mmmm...quick answer. Not pretty but surely works
That view is showed when you're writing, so I guess you should use it at searchBarTextDidBeginEditing. If I'm wrong, use it when you start searching or whatever.