[英]Interface Builder cannot find intrinsicContentSize defined in a custom view
Interface Builder cannot find intrinsicContentSize
of a custom view. Interface Builder无法找到自定义视图的intrinsicContentSize
。 For this given view code, 对于此给定的视图代码,
import Foundation
import UIKit
@IBDesignable
final class CustomView1: UIView {
override var intrinsicContentSize: CGSize {
return CGSize(width: 100, height: 100)
}
}
I put a UIView
instance and set its class to CustomView1
. 我放置了一个UIView
实例,并将其类设置为CustomView1
。 It works at first, but if I close and re-open the storyboard, IB sometimes (not always) shows an error. 它起初会起作用,但是如果我关闭并重新打开情节提要,IB 有时 (并非总是)显示错误。
IB cannot find width
of the view. IB无法找到视图的width
。
And this error disappears if I force Update Frames
. 如果我强制执行Update Frames
,此错误就会消失。
It looks like a bug. 看起来像个错误。 Or am I missing something important? 还是我错过了重要的事情? What's your opinion? 你怎么看? Any workaround? 任何解决方法?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.