奇怪的UIView框架大小

时间:2014-12-10 13:51:08

标签: ios xcode cocoa-touch interface-builder

在我的iOS应用程序中,我有一个带按钮和UIView的ViewController。下面是一个包含布局的屏幕展示:

Screenshot from storyboard

UIView控件通过autolayout与它的superview和按钮对齐。 我在viewDidLoad方法中放了一些日志来检查ViewController和UIView的大小:

override func viewDidLoad() {
    super.viewDidLoad()
    NSLog("VC bounds = \(self.view.bounds)")
    NSLog("Preview bounds = \(self.previewWindow.bounds)")
    NSLog("Preview frame = \(self.previewWindow.frame)")
}

这是日志结果:

2014-12-10 14:43:38.354 xxx[523:76131] VC bounds = (0.0,0.0,320.0,568.0)
2014-12-10 14:43:38.354 xxx[523:76131] Preview bounds = (0.0,0.0,600.0,528.0)
2014-12-10 14:43:38.355 xxx[523:76131] Preview frame = (0.0,20.0,600.0,528.0)

为什么UIView(预览)框架和边界的宽度大于ViewController?

问候,帕维尔

0 个答案:

没有答案