ios - xib自动调整大小之谜?

标签 ios objective-c iphone xcode

我有两个不同的项目 - 都有相同的设置/构建配置(我检查了所有内容..找不到任何区别),并且它们都包含对相同 XIB 文件的引用 - XIB 文件是为 iPhone 设计的4

这是我用于加载 Nib 的代码:

CGRect frame = [[UIScreen mainScreen] bounds]];
UnregScreen *screen = [[UnregScreen alloc] initWithFrame:frame];
[screenControl_ pushScreen:screen]; // Adds the view to the root view
...


// Inside UnregScreen:initWithFrame:
self = [super initWithFrame:frame];
NSArray *bundleObjects = [[NSBundle mainBundle] loadNibNamed:@"UnregScreen" owner:self options:nil];
for (id object in bundleObjects) {
    [self addSubview:object];
}

关于项目 1: 它在 iPhone 4 和 iPhone 6 上都运行良好。

在项目 2 上:它在 iPhone 4 上工作正常,但在 iPhone 6 上它不会自动调整 xib 的宽度,所以它看起来像这样(注意右侧的白色边距):

enter image description here

我正在用头撞墙,因为一切都一样。这是两个项目上相同的 xib - 在项目 1 上没问题,在项目 2 上则不然。

我应该看哪里?

最佳答案

选中“目标 -> 常规 -> 应用程序图标和启动屏幕”,如果您指定启动屏幕文件,则应用程序将以 native iPhone 6 分辨率呈现。而另一个项目以 iPhone 5 缩放分辨率呈现。

关于ios - xib自动调整大小之谜?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28069178/

相关文章:

ios - 自定义Tableview滑动 Action

ios - contextMenu中的NavigationLink

objective-c - 拥有自身的对象的 Objective C 命名约定

objective-c - UIScrollview 获取触摸事件

iphone - Objective-C 中的内存管理

iphone - 如何知道 url 中存在的图像

iphone - 管理多个按下的 UIButton

ios - 如何在 iPad 上隐藏状态栏?

ios - 获取排序记录的问题 (CoreData)

android - 我在哪里可以学习如何实现 'Where is my water' 的物理原理?