新的UIViewController帧是320x480而不是更大的屏幕尺寸

时间:2015-04-10 22:05:51

标签: ios objective-c uiviewcontroller

我今天更新了Xcode。

AppDelegate.m:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.vc = [[ViewController alloc] init];
    UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:self.vc];
    self.window.rootViewController = nc;
    [self.window makeKeyAndVisible];

    return YES;
}

ViewController.m:

- (void)viewDidLoad {
    [super viewDidLoad];
    CGRect f = self.view.frame;
    f =[[UIScreen mainScreen] bounds];
    self.view.frame = f;
    self.view.backgroundColor = [UIColor redColor];
}

框架显示为320x480。我可以清楚地看到视图周围有更多空间,但它是黑色的。为什么视图没有填写?没有XIB。

0 个答案:

没有答案