IBDesignable never finishes updating UITableViewCell in storyboard

后端 未结 3 816
萌比男神i
萌比男神i 2021-02-07 23:15

This is a similar question to this but not quite the same.

I have created a subclass of UITableViewCell which references a custom nib and marked it as @IBDesignable. Cha

3条回答
  •  青春惊慌失措
    2021-02-07 23:49

    I was having similar problems. This thread helped me understand the issue: Is there a way for Interface Builder to render IBDesignable views which don't override drawRect:

    I got it to work by adding

    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
            super.init(style: style, reuseIdentifier: reuseIdentifier)
            layoutSubviews()
        }
    

    as far as i understand after reading the above stack link, IBDesignable loads the nib in storyboard not from nib or from coder but from the init with frame. Not too sure but I think init with style is doing a similar thing.

提交回复
热议问题