Search code examples
iphonetoolbaruiwindow

May I add toolbar manually in UIWindows?


I added UIWindow and its toolbar like:

self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
NSArray * arr = [NSArray arrayWithObjects:@"test1", @"test2", nil];
[[self.window rootViewController] setToolbarItems:arr animated:NO];

No toolbar showing up.

Is it doable? Thanks.


Solution

  • You should add your viewController (with a toolbar) to the window after the window's init.