[英]custom tableview cell explaination
我創建了自定義 tableViewCell,我不明白為什么我需要初始化它 2 次,覆蓋 init 和 super.init,這段代碼是做什么的,請解釋一下
class tablecell: UITableViewCell {
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: .subtitle, reuseIdentifier: reuseIdentifier)
}
}
這個: super.init(style: .subtitle, reuseIdentifier: reuseIdentifier)
並不意味着你要init
兩次。
super
允許我們將表格視圖單元格的默認值與我們的自定義代碼一起使用。
所以super
說:我將使用我自己的代碼和 defaults 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.