简体   繁体   中英

UIViewController isn't displayed how it appears in interface builder

I'm having a problem with my view shifting down when I load my app. In interface builder it looks like: 在此处输入图片说明

But when I load the app on the iPod it looks like:

在此处输入图片说明

I'm not really concerned with why it isn't showing the grey background in interface builder, I set that and it's working. But I don't understand why the view is shifting down. I verified that I'm not changing the view's bounds or anything in my viewController. I'm just running [super viewDidLoad]; in my viewDidLoad.

I realize you can't see the frame or anything but I can answer any questions you have about the interface builder file.

Here's my didFinishLoading from my AppDelegate:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
    UINavigationController *navcon = [[[UINavigationController alloc] init] autorelease];
    [navcon pushViewController:[[GTSpotViewController alloc] init] animated:YES];
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    self.window.rootViewController = navcon;
    [self.window makeKeyAndVisible];
return YES;
}

You are adding your view controller to a UINavigationController. In this case, it will not look identical to how you view it in IB. Try setting the rootViewConroller directly to your viewcontroller.

你可以看看在属性检查器并设置顶部栏导航栏,然后一切都会正常排队。

while designing vies in IB therebia an option to set/keep space for navbar/toolbar in the inspector. try setting those values. alos check the resizing option.

Maybe are there two Navigation controller. check the xib to see if there's a Navigation controller.

事实证明,我的iPod上有一个旧版本,该版本以某种方式影响了构建,因为我清除了它,现在不再有任何变化。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM