开发者

iphone programming objective-c : viewDidLoad() execution

my application have a tabbarcontroller with 4 view Controllers.

Its called here :

self.window.rootViewController = tabBarController;

The view controller that appear first in the tabbar is called "Home" I want when opening the app to load the viewcontroller and not just the tabbar. It is possible? I want the ViewDidLoa开发者_如何学编程d() method from my Home view controller to be called. Thanks


If your application is based on a TabBarController, you want to load the viewControllers into your TabBarController and then add the TabBarControllers view to the window. For example:

FirstViewController *fvc = [[FirstViewController alloc] init];
SecondViewController *svc = [[SecondViewController alloc] init];

tabBarController.viewControllers = [NSArray arrayWithObjects:fvc,svc,nil];
[window addSubview:tabBarController.view];
[fvc release];
[svc release];

where tabBarController is an instance variable and property. The first tab to display when your app launches will be the first one you load into the array. In this case it is fvc.

Hope this helps.


Just go as usual load the first viewController (use it as Home page )and handle the tabbar hidden property (where you want to show or hide it).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜