Ios 如何在iMessage扩展中激活UISearchController
我的iMessage应用程序中有一个Ios 如何在iMessage扩展中激活UISearchController,ios,swift,uisearchbar,uisearchcontroller,imessage,Ios,Swift,Uisearchbar,Uisearchcontroller,Imessage,我的iMessage应用程序中有一个UISearchBar。UISearchBar不能在精简演示文稿样式中处于活动状态,因此当演示文稿样式更改时,我希望请求扩展演示文稿样式,然后激活搜索栏。这就是苹果的#images iMessage应用程序所做的。这是我的密码: func searchBarShouldBeginEditing(_ searchBar: UISearchBar) -> Bool { if presentationStyle == .expanded {
UISearchBar
。UISearchBar不能在精简演示文稿样式中处于活动状态,因此当演示文稿样式更改时,我希望请求扩展演示文稿样式,然后激活搜索栏。这就是苹果的#images iMessage应用程序所做的。这是我的密码:
func searchBarShouldBeginEditing(_ searchBar: UISearchBar) -> Bool {
if presentationStyle == .expanded {
return true
} else {
requestPresentationStyle(.expanded)
return false
}
}
override func didTransition(to presentationStyle: MSMessagesAppPresentationStyle) {
if presentationStyle == .expanded {
searchController.searchbar.becomeFirstResponder()
}
}
问题是此代码导致my
UISearchBar
消失。我做错了什么?对我来说,同样的问题,如果我找到了解决方案,我会发布它here@RoaflinSabos能否提供一些有关如何设置UISearchController的详细信息?我很高兴知道我不是唯一一个有这个问题的人,我正计划开始悬赏以获得更多关注。最后我没有使用UISearchController。我只有一个简单的UISearchBar,我有和你一样的代码。现在一切都很好,我也这么做了。非常不方便,尽管没有UISearchController功能很奇怪,但我在iMessage扩展中使用常规的UISearchBar,问题仍然存在。有人找到解决办法了吗?