【发布时间】:2012-02-19 12:30:14
【问题描述】:
我无法弄清楚为什么该代码会导致应用崩溃。
AppDelegate.h
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.rootViewController = [[[RootViewController alloc]init]autorelease];
[self.window setRootViewController:self.rootViewController];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
这里是 RootViewController.m 代码
-(void)loadView
{
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(10, 10, 10, 10)];
[view setBackgroundColor:[UIColor lightGrayColor]];
[self.view addSubview:view];
[view release];
}
我在调试器中收到该消息
Unable to restore previously selected frame.
【问题讨论】:
标签: objective-c ios xcode uiview