Interface Builder cannot find intrinsicContentSize
of a custom view. 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
. It works at first, but if I close and re-open the storyboard, IB sometimes (not always) shows an error.
IB cannot find width
of the view.
And this error disappears if I force Update Frames
.
It looks like a bug. Or am I missing something important? What's your opinion? Any workaround?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.