I need UIToolbar
when my application launches. It will be on every screen through out the application. So for that i have add it in RootViewController
.
#import "AppDelegate.h"
#import "MainViewController.h"
@implementation AppDelegate
@synthesize window = _window;
@synthesize mainViewController = _mainViewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]autorelease];
// Override point for customization after application launch.
self.mainViewController = [[[MainViewController alloc]init]autorelease];
self.window.rootViewController = self.mainViewController;
[self.window makeKeyAndVisible];
return YES;
}
Currently i have UIToolbar in MainViewController
// create the UIToolbar at the bottom of the MainViewController
toolbar = [UIToolbar new];
toolbar.barStyle = UIBarStyleBlackOpaque;
// size up the toolbar and set its frame
toolbar.frame = CGRectMake(0, 425, 320, 40);
[self.view addSubview:toolbar];
In all my other UIViewControllers
i m adding it like this
[self.view addSubview:toolbar];
which i don't want. I want UIToolbar
to show automatically in all my other UIViewControllers
after attaching it to rootviewcontroller
. so that when i flip UIViewController
to change to another UIViewController
. Only UIViewController
should flip not UIToolbar
.Right now UIToolbar
is also flipping with UIViewController
. So that is the reason i want to attach it to the rootviewcontroller
.
So how can i add UIToolbar in APPDelegate
file and attach it to rootviewcontroller
.
Thanks for help.