作者Gsus (肉元,吉米,助教)
看板MacDev
标题Re: [问题] 程式的流程-viewController想call supe …
时间Sat Jul 24 09:50:07 2010
※ 引述《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