Re: [問題] 程式的流程-viewController想call supe …
※ 引述《zonble (zonble)》之銘言:
: 聽起來你想要做的事情就是,你想要把 applcation delegate 裡頭
: 定義的那個 window 上面換不同的內容,原本是 FirstViewContoller
: 的 view,把這個 view 拿掉,然後換成 tabBarController 的 view
: 我假設 firstViewController 與 tabBarController 都是 AppDelegate
: 的成員變數,那麼,先在 AppDelegate 裡頭弄一個 method
: - (void)useTabBarView
: {
: [firstViewController viewWillDisappear:YES];
: [firstViewController.view removeFromSuperView];
: [firstViewController viewDidDisappear:YES];
: [tabBarController viewWillAppear:YES];
: [window addSubview:tabBarController.view];
: [tabBarController viewDidAppear:YES];
: // 高興的話還可以加上 UIVew animation…
: }
: 然後,我們在 a/bViewController 要拿到 AppDelegate 物件,就可以
: 呼叫這個 method 了。
: 1. 在 a/vViewController 裡頭要 inlucde AppDelegate 的 header
: 2. 大概是這樣寫
: AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
: [appDelegate useTabBarView];
: 我好像在前面哪邊也有提到怎樣拿到 AppDelegate 的 instance。
我還想多問一個問題
有沒有一種可能是在 a/bViewController 中判斷
有哪些 objects 手中 hold 自己 instance
然後取得那些 objects 的 reference
接著我就可以 call 那些 objects 的 methods
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.248.4.56
討論串 (同標題文章)
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章