我有一个问题,那就是我正在尝试放置 Smooch 的聊天 UI,但这始终在 iPhone 6s 中以全屏模式显示。有人能帮我吗?
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "popoverSegue" {
// Get the new view controller using segue.destinationViewController.
let popoverViewController: SmoochViewController = segue.destination as! SmoochViewController
//popoverViewController.newViewController = Smooch.newConversationViewController()
popoverViewController.modalPresentationStyle = UIModalPresentationStyle.popover
popoverViewController.popoverPresentationController!.delegate = self
}
}
这就是我试图展示显示聊天的 SmoochViewController 的方式。
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// Adding some values to the user
SKTUser.current()!.firstName = "Kevin" // User's first name
SKTUser.current()!.lastName = "Bustillos Acurio" // User's lastname
SKTUser.current()!.email = "kevinbustillos21@hotmail.com" // User's email
SKTUser.current()!.signedUpAt = Date() // User's sign in date
let conversation: SKTConversation = Smooch.conversation()!
// Debugging messages (can be deleted)
for message in conversation.messages! {
print("MESSAGES \((message as! SKTMessage).text)")
}
let newViewController: UIViewController = Smooch.newConversationViewController()!
// Display Smooch UI (it displays the UI, the messages, avatars, all...)
Smooch.showConversation(from: newViewController)
// Just for debugging
print("USER ID \(SKTUser.current()!.userId)")
print("SMOOCH ID \(SKTUser.current()!.smoochId)")
print("CURRENT USER FIRST NAME: \(SKTUser.current()!.firstName)")
print("CURRENT USER LASTNAME: \(SKTUser.current()!.lastName)")
print("CURRENT USER EMAIL: \(SKTUser.current()!.email)")
print("CURRENT USER DATE: \(SKTUser.current()!.signedUpAt)")
}
这就是我试图在不同的 UIViewController 中呈现聊天的方式
谢谢!