'required' initializer 'init(coder:)' must be provided by subclass of 'UITableViewCell'`

前端 未结 4 1980
夕颜
夕颜 2020-12-15 03:46

This code has reportedly worked here and here, but I can\'t seem to make it work.

The IBOutlets are hooked up to their objects in the storyboard. The prototypeCell i

4条回答
  •  余生分开走
    2020-12-15 04:40

    The right way to inherit UITableViewCell in Swift 4:

    class MyTableViewCell: UITableViewCell
    {    
        override init(style: UITableViewCellStyle, reuseIdentifier: String?)
        {
            super.init(style: style, reuseIdentifier: reuseIdentifier)
        }
    
        required init?(coder aDecoder: NSCoder)
        {
            super.init(coder: aDecoder)
        }
    }
    

提交回复
热议问题