我有一个名为HomeViewController的pageViewController。在其中我有三个视图,名为Overview,Finance和BSC。 在第三个屏幕(BSC)上我有一个collectionView。如何根据集合视图中的“didSelectItemAt”方法推送到另一个屏幕?
答案 0 :(得分:0)
我的行动:
let notificationName = Notification.Name("bscNotification")
NotificationCenter.default.post(name: notificationName, object: nil, userInfo:["id":indicator!])
HomeViewController(PageViewController)中的:
let bscNotificationName = Notification.Name("bscNotification")
NotificationCenter.default.addObserver(self, selector: #selector(HomeViewController.showBSCInfo(notification:)), name: bscNotificationName, object: nil)
func showBSCInfo(notification:NSNotification){
let vc = UIStoryboard.init(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "BSCInfoViewController") as! BSCInfoViewController
vc.IdIndicador = notification.userInfo!["id"]! as! String
vc.showBackButton = true
self.navigationController?.pushViewController(vc, animated: true)
}