nib + 代码,在iOS8不会自动加载nib, 这段代码在保证在初始化时指定nib文件.
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
let name = String(describing: type(of: self))
super.init(nibName: name, bundle: nil)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
网友评论