[問題] 程式的流程-viewController想call superViewController 方法
我有一個程式是這樣的
一開始在appDelegate中會init 2 個controller
-firstViewController
-textView
-containerView
-aViewController
-bViewController
-tabBarController
流程如下:
我先add firstViewController.view
[windows addSubview:firstViewController.view];
在firstViewController.view中包含了兩個view
-textView
-containerView
在containverView中會視情況add 兩種 view
可能是 -aViewController.view
或者是 -bViewController.view
不論是aViewController.view or bViewController.view中
最終都要按下一個button,然後就該換tabBarController.view上場,
然後firstViewController.view就要被remove
問題就出現在這邊
我要怎麼在a/bViewController中remove自己 ?
並且讓appDelegate去add tabBarController.view ?
--
1.
我知道的方法有利用protocol,在appDelegate中實作protocol的method
並且在a/bViewController中call appDelegate中的protocol method
但是我想問有沒有其他的方法?
2.
也是可以直接在firstViewContoller.view上add tabBarController.view
但是因為firstViewController.view很少有機會會用到
甚至有時候程式進入時根據user defaults
就會決定不建立firstViewController instance
直接開始tabBarController.view
所以我想每次進入程式都讓firstViewController在那邊也不太好
不知道這樣思考正不正確
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.136.190.30
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章