【发布时间】:2019-10-15 01:08:21
【问题描述】:
我试图在按下 UiView 内部的按钮后显示消息 viewController。当我按下按钮时,消息 viewController 会出现,但它缺少一些数据。我有一个单独的 viewController 允许我推送控制器。我将在下面留下图片以显示我在说什么。
这就是消息视图控制器的样子,也是到达那里的代码的样子
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
dismiss(animated: true) {
print("Dismiss completed")
let user = self.user[indexPath.row]
self.messagesController?.showChatControllerForUser(user)
}
}
当我从 UiView 推送视图时会发生这种情况,这就是代码到达那里的样子。
@objc func handleNewMessage() {
let chatLogController = ChatLogController(collectionViewLayout: UICollectionViewFlowLayout())
chatLogController.user = user
let navVC = UINavigationController(rootViewController:chatLogController)
self.window?.rootViewController?.present(navVC, animated: true, completion: nil)
}
所有数据都通过了,但是缺少后退按钮,并且不允许我实际发送消息。我正在使用两种不同的方法来访问同一个控制器,我希望看到相同的结果。我想知道是否有人可能是新的如何解决这个问题?
【问题讨论】:
标签: swift xcode uiview pushviewcontroller didselectrowatindexpath