ios - iMessage 应用程序以编程方式扩展 View

标签 ios swift segue imessage imessage-extension

当用户点击我的 iMessage 应用程序中的箭头以转换到扩展 View 时,我有下面的代码来处理调整大小,但是当用户转到我的新 View Controller 时,我如何以编程方式打开扩展 View iMessage 应用程序?

override func didTransition(to presentationStyle: MSMessagesAppPresentationStyle) {
    // Called after the extension transitions to a new presentation style.

    if presentationStyle == MSMessagesAppPresentationStyle.compact {
        //Resize Views
    }
}

最佳答案

假设您在 MessagesViewController 中调用它,您可以通过以下方式以编程方式打开展开的 View :

Swift 版本:

if self.presentationStyle == MSMessagesAppPresentationStyle.compact {
    self.requestPresentationStyle(MSMessagesAppPresentationStyle.expanded)
}

Obj-C 版本:

if (self.presentationStyle == MSMessagesAppPresentationStyleCompact) {
    [self requestPresentationStyle:MSMessagesAppPresentationStyleExpanded];
}

关于ios - iMessage 应用程序以编程方式扩展 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42324527/

相关文章:

ios - 需要帮助在 iOS 日历 (Swift) 的事件中保存唯一的自定义标识符

objective-c - 单击 UIButton 以编程方式创建 Segue 或推送到另一个 View Controller

swift - 如何使用 Swift 在 Xcode 6 中执行自动转场?

android - 使用 'google_maps_flutter' 插件无法在 Flutter 中显示当前用户位置

ios - 如果将 UDID 添加到现有配置文件,IPA 是否需要重新生成?

ios - 元组的 Swift 可选绑定(bind)

iphone - 通过 segue 传输 View Controller 后隐藏单元格

iOS自定义UINavigationBar - barButtonItems接收触摸越界

ios - 长按时单元格 ImageView 更改

ios - 如何将数据从 Realm 传递到 ViewController