我正在做一个项目,遇到了一个障碍。我到处搜索,尝试了我在博客,其他堆栈溢出帖子等中找到的所有东西,但没有任何效果。
这是我的问题。
我正在尝试创建一个聊天应用程序,当单击/点击某个人时,该应用程序将打开消息。我的开放界面做得很好,但我不能让过渡发生。我开始在故事板上做这个项目,然后转为主要的代码。
我的聊天控制器代码如下:
//**My attempt at creating the transition**
override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let layout = UICollectionViewFlowLayout()
let controller = ChatLogController(collectionViewLayout: layout)
controller.friend = messages?[indexPath.item].friend
self.navigationController?.pushViewController(controller, animated: true)
}
}
我试图转换到并传递数据的视图
import UIKit
class ChatLogController: UICollectionViewController, UICollectionViewDelegateFlowLayout {
var friend: Friend?{
didSet{
}
}
override func viewDidLoad(){
super.viewDidLoad()
}
}