方法1:xib定制view
<1> 设置File's Owner ---> 指向对应的 view

<2> 拖拽出view 到 代码

<3> 代码中设置

方法2:代码定制view
classCourseHeaderView:UIView{
over rideinit(frame:CGRect) {
super.init(frame: frame)
configUI()
}
required init?(coder aDecoder:NSCoder) {
super.init(coder: aDecoder)
configUI()
}
fileprivate func configUI() {
print("配置UI")
}
}
网友评论