Swift에서 UITableViewCell을 하위 클래스로 만들려고합니다.Override init (코더 aDecoder : NSCoder!)가 예상대로 작동하지 않습니다. - Swift
나는이 시도했다 :
class CUISwitchTableViewCell: UITableViewCell {
var label = UILabel()
var switchControl = UISwitch()
init(coder aDecoder: NSCoder!) {
super.init(coder: aDecoder)
// Set up UI
}
}
을하지만 super.init(coder: aDecoder)
를 호출 할 때 나는 컴파일러 오류가 발생합니다 :
는 슈퍼 클래스 '있는 UITableViewCell'
의 지정 초기화를 호출해야합니다 그래서 내가 이해해야 할 것은 init(style: UITableViewCellStyle, reuseIdentifier: String!)
으로 전화해야한다는 것입니다. 그런 다음 Interface Builder에서 이루어진 모든 설정을 잃게됩니다. initWithCoder를 재정의하지 않으면 뷰를 어디에 설정해야합니까?