티스토리 뷰
@IBDesignable
class SeparatorButtons: UIView {
let nibName = "SeparatorButtons"
var contentView: UIView?
override init(frame: CGRect) {
super.init(frame: frame)
loadViewFromNib()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
loadViewFromNib()
}
override func prepareForInterfaceBuilder() {
super.prepareForInterfaceBuilder()
loadViewFromNib()
}
func loadViewFromNib() {
let bundle = Bundle(for: type(of: self))
let nib = UINib(nibName: nibName, bundle: bundle)
let view = nib.instantiate(withOwner: self, options: nil).first as! UIView
view.frame = self.bounds
self.addSubview(view)
contentView = view
}
}
'macOS, iOS' 카테고리의 다른 글
textFieldDelegate로 리턴버튼이나 textField 바깥 영역 눌렀을 때 keyboard dismiss (0) | 2019.11.22 |
---|---|
카카오맵 왜 옵젝씨밖에 없냐 ㅡㅡ (0) | 2019.11.22 |
[Swift] typealias (0) | 2019.11.13 |
[iOS] required init()과 override init()의 차이는 무엇일까 (0) | 2019.11.11 |
[iOS] view outlet was not set 에러 고치기 (xib) (0) | 2019.11.11 |