view based application
hii...
I am making a view based application in which I have tabbar controller but this application has no of pages. And I am adding these pages as subview due to which stack get increase each. I want to put navigation bar controller too in this application to decrease the memory allocation.
Can it possible to h开发者_如何学Goave tabbar and navigation bar controller both in view based application.
If anyone know how to implement it. Then please help me.
Thanks in advance.
But of course, in AppDelegate.m, include
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
ViewController1 *vc1 = [[ViewController1 alloc] init];
UINavigationController *nc1 = [[UINavigationController alloc] initWithRootViewController:vc1];
ViewController2 *vc2 = [[ViewController2 alloc] init];
UINavigationController *nc2 = [[UINavigationController alloc] initWithRootViewController:vc2];
NSArray *navControllers = [NSArray arrayWithObjects:nc1, nc2, nil];
[nc1 release]; [nc2 release];
tabBarController = [[UITabBarController alloc] init];
[tabBarController setViewControllers:navControllers];
[window addSubview:[tabBarController view]];
[window makeKeyAndVisible];
return YES;
}
This sets up two views for the tabBar controller, each with its own navigation controller. You can modify this as you like to add more view with or without navigation controllers
精彩评论