Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/117.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何在iMessage扩展中激活UISearchController_Ios_Swift_Uisearchbar_Uisearchcontroller_Imessage - Fatal编程技术网

Ios 如何在iMessage扩展中激活UISearchController

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 {

我的iMessage应用程序中有一个
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,问题仍然存在。有人找到解决办法了吗?