我正在将视图控制器的视图添加到我的窗口中,application:didFinishLaunchingWithOptions:
但该视图不可见。我不确定出了什么问题。
这是我的应用程序委托代码:
@class ToolBar;
@class MainViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
UIWindow *Window;
//UIToolbar *toolbar;
}
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) MainViewController *mainViewController;
@property (strong, nonatomic) ToolBar *toolbar;
@end
#import "AppDelegate.h"
#import "MainViewController.h"
#import "ToolBar.h"
@implementation AppDelegate
@synthesize window = _window;
@synthesize mainViewController = _mainViewController;
@synthesize toolbar =toolbar;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]autorelease];
self.mainViewController = [[[MainViewController alloc]init]autorelease];
[self.window addSubview:self.mainViewController.view];
//[self.window makeKeyAndVisible];
self.toolbar = [[[ToolBar alloc]init]autorelease];
[self.window addSubview:toolbar.view];
[self.window makeKeyAndVisible];
return YES;
}