all*_*ire 14 iphone xcode interface-builder ios swift
我正在使用UIAppearance
很多导航控制器和其他UI对象,我想知道是否可以在Interface Builder中设置我的相关对象(可能有一些神奇的伏都教@IBDesignable
?)
matt对这个问题的评论是正确的.您可以在prepareForInterfaceBuilder
方法中成功使用UIAppearance代理.
例:
@IBDesignable
class MyCustomView: UIView {
override func prepareForInterfaceBuilder() {
MyCustomView.appearance().backgroundColor = UIColor.redColor()
}
}
Run Code Online (Sandbox Code Playgroud)
这将导致所有MyCustomView
实例在IB中呈现为红色.
归档时间: |
|
查看次数: |
956 次 |
最近记录: |