简体   繁体   English

UIView显示在屏幕顶部。

[英]UIView is shown displaced at the top of the screen

OK, hopefully a stupid question from a newbie... 好吧,希望有一个新手提出的愚蠢的问题...

I have an app that used to display fine base on XIB files created in UI Builder. 我有一个应用程序,用于根据UI Builder中创建的XIB文件很好地显示。 The .xib still displays fine using the simulator direct from the UIB but when compiled and run, the view is displaced by 40 or 50 pixels (about 1/3 the width of a nav bar) so that I get a bar of white space at the bottom and half my title text hidden on the nav bar at the top. .xib仍然可以直接从UIB使用模拟器显示,但是编译并运行后,视图移位了40或50像素(大约是导航栏宽度的1/3),因此我在标题的底部和一半隐藏在顶部的导航栏中。

I have tried fiddling with various parameters for the view and main window (eg layout wants full screen and resize view from NIB) but nothing seems to make any difference. 我已经尝试过修改视图和主窗口的各种参数(例如,布局需要全屏显示并从NIB调整视图大小),但是似乎没有任何区别。

I tried upgrading xcode from 3 to 4 but no difference. 我尝试将xcode从3升级到4,但没有区别。

Any pointers gratefully received... 非常感谢收到任何指针...

我不知道您的具体情况,但是布局问题通常归结为不适当指定的自动调整参数。

Pure speculation: 纯推测:

Fiddling around in Interface Builder, in the typical template xib file, you can get two windows to draw your interface on. 在Interface Builder中摆弄,在典型的模板xib文件中,您可以获得两个窗口来绘制您的界面。 One of them refers to the window, the other to the view controller. 其中一个引用窗口,另一个引用视图控制器。 You should leave the window alone. 您应该不理会窗户。 Anything you put in there is placed relative to the window, ie the screen. 您在其中放置的所有内容都相对于窗口(即屏幕)放置。 This would typically lead to what you describe. 这通常会导致您所描述的。

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

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