iMessage App以编程方式扩展视图

时间:2017-02-19 06:55:36

标签: ios swift segue imessage imessage-extension

当用户点击我的iMessage应用程序中的箭头以转换到展开的视图时,我有以下代码来处理调整大小,但是当用户在我的网站中切换到新的视图控制器时,如何以编程方式打开展开的视图iMessage app?

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

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

1 个答案:

答案 0 :(得分:5)

假设您在MessagesViewController中调用此方法,您可以通过以下方式以编程方式打开展开的视图:

Swift版本:

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

Obj-C版本:

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