我正在爲iPhone開發iMessage應用程序。它目前允許用戶按下箭頭將應用從鍵盤大小調整爲全屏。對於我的應用程序,全屏視圖不是必需的。禁用iMessage應用程序調整大小
是否可以在iMessage應用程序中禁用調整大小?
謝謝
我正在爲iPhone開發iMessage應用程序。它目前允許用戶按下箭頭將應用從鍵盤大小調整爲全屏。對於我的應用程序,全屏視圖不是必需的。禁用iMessage應用程序調整大小
是否可以在iMessage應用程序中禁用調整大小?
謝謝
恐怕這個箭頭總是會調用全屏幕布局。你必須同時處理這兩個問題。 但這裏有一些想法:
didTransition(to: MSMessagesAppPresentationStyle)
。所以你可以使用緊湊模式requestPresentationStyle(_ presentationStyle: MSMessagesAppPresentationStyle)
。所以,當它試圖全屏顯示時,它會回到緊湊模式requestPresentationStyle(_ presentationStyle: MSMessagesAppPresentationStyle)
來始終顯示緊湊模式,而不是擴展模式。他們這樣說:不過
注意的是,用戶應在 擴展的呈現樣式的最終控制權。如果用戶選擇更改演示文稿樣式,則應該遵守該選擇。
除了上面: - 當人回覆消息,也有情景活動和非活動狀態2
: - 生命週期活動狀態的
:
iMessage Tap
func willTransition(to presentationStyle:MSMessagesAppPres entationStyle)
FUNC didSelect(_消息:MSMessage,會話:MSConversation)
FUNC didTransition(到presentationStyle:非活動狀態 MSMessagesAppPresentationStyle)
生命週期:
iMessage Tap
didBecomeActive(與對話:MSConversation) FUNC viewWillAppear中(_動畫:BOOL)
FUNC viewDidAppear(_動畫:BOOL)
因此,在非活動狀態 willTransition將接管控制權。
但是在活動狀態中,您無法控制過渡,所以默認情況下它將以擴展形式打開。在didBecomeActive方法中,您必須調用以下函數才能轉換爲不同的樣式。
這些功能將有助於從一個過渡態移動到另一個MessagesViewController: -
requestPresentationStyle(.expanded)
requestPresentationStyle(.compact)
以上方法將調用willTransition和didTransition: -
override func willTransition(to presentationStyle: MSMessagesAppPresentationStyle) {
//Here we can check the presentationStyle and move the Controller according to need . i.e
let controller: UIViewController
if presentationStyle == .compact {
controller = instantiateCompactController()
}
else {
controller = instantiateExpandController()
}
//and then Present Controller
}
好的。我會看一看。謝謝。 –
那麼你是否找到了解決問題的辦法? – RomOne