这是AppDelegate里的代码,还定义了一个UIView类BNRHypnosister,里面只有一个实参CGRect
return YES;
}
代码看不清楚- -
另外没用过BNRHypnosister 。 但是我用UIview 是可以的
self.window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
UIViewController *emptyView = [[UIViewController alloc] initWithNibName: nil bundle:nil ];
self. window .rootViewController = emptyView;
CGRect firstFrame = CGRectMake(100.0f, 10.0f, 200, 300);
UIView *firstView = [[UIView alloc] initWithFrame: firstFrame];
firstView.backgroundColor = [UIColor redColor]; [self.window addSubview: firstView];
self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible];
return YES;
----
Copy你的代码 CGRect firstFrame = CGRectMake(100.0f, 10.0f, 200, 300); 这句代码后面少了;号
CGRectmake是针对于当前视图的视图来说的,windows本身默认就是全屏。你要看清楚相对滴,虽然我也不清楚你最根本的问题是什么