简体   繁体   中英

iPhone View Cutting Off

The view is created in interface builder, and is strangely cutting off at the bottom, and help or suggestions, is appreciated.

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


    [self.window addSubview:viewController.view];
    [self.window makeKeyAndVisible];

    return YES;
}

在此处输入图片说明

在此处输入图片说明

Edit: I don't actually have a nib for the view controller, but instead a main window nib and a nib for two different views which are different themes.

Also if I use:

self.window.rootViewController = self.viewController;

it does not happen, but sadly this will crash in iOS 3.2 or below.

In interface builder you need to check the dimensions of the view. You will see that it is too short (your height is probably set to 440, but it should be 460, or 480 if you don't have the status bar). This is probably why it appears to be cutting off.

I experience the same problem, what I do is translating view 20 pixels down in ViewDidLoad then everything works fine. The problem surely is related to the statur bar but I do not know a solution other than this workaround.

To translate the view use this:

self.view.transform = CGAffineTransformMakeTranslation( 0, 20 );

Try enabling a simulated status bar in IB.

在此处输入图片说明

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