2016-11-17 3 views
0

私はHomeViewControllerと呼ばれるpageViewControllerを持っています。その中には、Overview、Finance、BSCの3つのビューがあります。 3番目の画面(BSC)には、collectionViewがあります。コレクションビューの「didSelectItemAt」メソッドに従って別の画面にプッシュするにはどうすればよいですか?UIPageViewControllerは別のビューをプッシュしません

+0

あなたは、通知オブザーバとしてPageViewControllerを追加し、collectionViewのセルが選択されたときに通知を投稿することができます。これが解決策の1つです。もっと多くのことがあります。 – Adeel

+0

ホームViewControllerに通知を追加しますか? – breno

+0

Emm!このように言うのは難しいです。おそらくスクリーンの構造とコードのスクリーンショットを追加するべきです。それでは、どこに置くべきかを提案することができます。 – Adeel

答えて

0

マイ処置:HomeViewController(PageViewController)で

let notificationName = Notification.Name("bscNotification") 
     NotificationCenter.default.post(name: notificationName, object: nil, userInfo:["id":indicator!]) 

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) 
    } 
関連する問題