Setting style of UITableViewCell when using iOS 6 UITableView dequeueReusableCellWithIdentifier:forIndexPath:

后端 未结 6 1805
庸人自扰
庸人自扰 2020-12-02 07:28

I\'m trying to work out how to set the UITableViewCellStyle when using the new methods in iOS 6 for UITableView.

Previously, when creating

6条回答
  •  暖寄归人
    2020-12-02 07:40

    Bolot's answer is the correct. Simple and you don't need to create any XIB file.

    I just wanted to update his answer for whoever is doing it using Swift instead of Objective-C:

    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: .value1, reuseIdentifier: reuseIdentifier)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    

提交回复
热议问题