【发布时间】:2015-09-30 08:26:43
【问题描述】:
我是 iOS 开发新手。我正在使用 swift,我想以编程方式设计我的视图,但我想使用 IBDesigner 和 IBInspectable 来加快我的设计过程。
现在我有一个视图控制器,上面有各种按钮和标签。这是我的代码的 sn-p:
@IBDesignable class LandingView: UIViewController, LandingViewProtocol {
@IBInspectable lazy var backButton: UIButton = {
var button = UIButton()
button.backgroundColor = Styles.BUTTON_COLOR
return button
}()
@IBInspectable lazy var caption: UILabel = UILabel()
}
我现在的问题是如何将界面构建器与 IBDesignable 和 IBInspectable 一起使用?我需要添加 .xib 吗?我看到其他一些问题提到我需要使用游乐场,但我试图避免使用它,我基本上想知道是否可以查看我的整个视图控制器?
谢谢,
【问题讨论】:
标签: ios swift uiviewcontroller