UIPageViewController没有推送另一个视图

时间:2016-11-17 18:20:33

标签: ios iphone swift xcode mobile

我有一个名为HomeViewController的pageViewController。在其中我有三个视图,名为Overview,Finance和BSC。 在第三个屏幕(BSC)上我有一个collectionView。如何根据集合视图中的“didSelectItemAt”方法推送到另一个屏幕?

1 个答案:

答案 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)
    }