模拟器中的UIView边界/绘图不正确

我创建了一个单视图测试应用程序,并将UIButtonUIView添加到主故事板中的UIViewController 。 我已将按钮视图调整为大小相同。

在此处输入图像描述

在我的VC的-viewDidAppear:动画方法中我转储了按钮和视图的框架和边界:

 - (void)viewDidAppear:(BOOL)animated { NSLog(@"button bounds: %@", NSStringFromCGRect(self.theButton.bounds)); NSLog(@"button frame: %@", NSStringFromCGRect(self.theButton.frame)); NSLog(@"view bounds: %@", NSStringFromCGRect(self.theView.bounds)); NSLog(@"view frame: %@", NSStringFromCGRect(self.theView.frame)); } 

这是在模拟器中运行时的输出:

 button bounds: {{0, 0}, {100, 100}} button frame: {{110, 72}, {100, 100}} view bounds: {{0, 0}, {100, 12}} view frame: {{110, 179}, {100, 12}} 

在设备上运行时:

 button bounds: {{0, 0}, {100, 100}} button frame: {{110, 72}, {100, 100}} view bounds: {{0, 0}, {100, 100}} view frame: {{110, 179}, {100, 100}} 

我不明白为什么在模拟器中运行时视图报告高度为12。 视图在模拟器中绘制不正确,但在设备上运行时按预期绘制。 请注意, UIViewController的最顶层UIVIew未选中“Autoresize Subviews”(尽管它无论如何都没有区别)。

(Xcode 4.5.2.iOS 6.0)

谢谢,CS

在此处输入图像描述

单击显示布局中的“应用Retina 4 Form Factor”按钮。 您为Retina 4设置了此设置,因此在模拟器中运行时屏幕会调整为3.5。 您可以通过运行iPhone5模拟器(Retina 4英寸)来validation这一点。 在将形状因子切换为3.5“后,您会注意到高度更改为12。

在此处输入图像描述