【发布时间】:2012-02-12 20:47:42
【问题描述】:
我有一个名为 MMAppDelegate.m 的文件:
#import "MMAppDelegate.h"
@implementation MMAppDelegate
@synthesize window;
@synthesize viewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
viewController = [[MainViewController alloc] init];
[window addSubview:viewController.view];
// Override point for customization after application launch.
[window makeKeyAndVisible];
return YES;
}
//and more standard methods
MMAppDelegate.h:
#import <UIKit/UIKit.h>
#import "MainViewController.h"
@interface MMAppDelegate : UIResponder <UIApplicationDelegate> {
UIWindow *window;
MainViewController *viewController;
}
@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) MainViewController *viewController;
@end
MainViewController.m:
#import "MainViewController.h"
@implementation MainViewController
- (void)viewDidLoad {
NSLog(@"view did load main view controller");
[super viewDidLoad];
self.view.backgroundColor = [UIColor redColor];
}
@end
然而,当我运行程序时,我得到一个黑屏,并且输出:
2012-02-12 15:44:48.160 MoreMost[44076:f803] view did load main view controller
2012-02-12 15:44:48.163 MoreMost[44076:f803] Applications are expected to have a root view controller at the end of application launch
有什么问题?
【问题讨论】:
标签: ios ipad uiview uiviewcontroller