简体   繁体   English

iPhone视图中断

[英]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. 它不会发生,但可悲的是,这将在iOS 3.2或更低版本中崩溃。

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). 您会发现它太短了(您的高度可能设置为440,但是应该为460,如果没有状态栏,则应该为480)。 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. 我遇到了同样的问题,我要做的是在ViewDidLoad中将视图向下平移20个像素,然后一切正常。 The problem surely is related to the statur bar but I do not know a solution other than this workaround. 该问题肯定与statur bar有关,但是除了这种解决方法外,我不知道其他解决方案。

To translate the view use this: 要翻译视图,请使用以下命令:

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

Try enabling a simulated status bar in IB. 尝试在IB中启用模拟状态栏。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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