UIToolbar
我的应用程序启动时需要。它将出现在整个应用程序的每个屏幕上。所以为此我将它添加到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;
}
目前我有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];
在我所有的其他UIViewControllers
即时通讯中添加它是这样的
[self.view addSubview:toolbar];
我不想要。我想UIToolbar
在UIViewControllers
附加到rootviewcontroller
. 这样当我翻转UIViewController
到另一个时UIViewController
。只是UIViewController
应该翻转不UIToolbar
。现在UIToolbar
也翻转着UIViewController
。所以这就是我想将它附加到rootviewcontroller
.
那么如何添加UIToolbar in APPDelegate
文件并将其附加到rootviewcontroller
.
感谢帮助。