2016-11-17 68 views
0

我有一个名为HomeViewController的pageViewController。在内部,我有三种观点,分别是Overview,Finance和BSC。 在第三个屏幕(BSC)上有一个collectionView。如何根据集合视图中的“didSelectItemAt”方法推送到另一个屏幕?UIPageViewController不推送另一个视图

+0

您可以添加PageViewController为通知观察者和当选择的CollectionView的小区张贴通知。这是解决方案之一。可能还有更多。 – Adeel

+0

我在家庭ViewController中添加通知? – breno

+0

Emm!这很难说。您应该添加屏幕结构和代码的屏幕截图。然后,我将能够建议放置在哪里。 – Adeel

回答

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) 
    } 
相关问题