就像UILabel类一样:
class UILabel : UIView, NSCoding {
var text: String! // default is nil
var font: UIFont! // default is nil (system font 17 plain)
var textColor: UIColor! // default is nil (text draws black)
var shadowColor: UIColor! // default is nil (no shadow)
var shadowOffset: CGSize // default is CGSizeMake(0, -1) -- a top shadow
....
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我定义一个这样的类,它也没有init函数.编译器会警告我.我怎么能像苹果那样做,隐藏实现,只声明接口.谢谢.
| 归档时间: |
|
| 查看次数: |
683 次 |
| 最近记录: |