Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IBDesignable never finishes updating UITableViewCell in storyboard

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. Changes that are made both in code and from the .xib file display correctly in the simulator and on a device but not in the storyboard.

import UIKit

@IBDesignable class TextFieldTableViewCell: UITableViewCell {

    var view: UIView!

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)

        setup()
    }

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

        setup()
    }

    func setup() {
        view = loadViewFromNib()
        view.frame = bounds
        view.autoresizingMask = [UIViewAutoresizing.FlexibleWidth, UIViewAutoresizing.FlexibleHeight]
        contentView.addSubview(view)
    }

    func loadViewFromNib() -> UIView {

        let bundle = NSBundle(forClass: self.dynamicType)
        let nib = UINib(nibName: "TextFieldTableView", bundle: bundle)
        let view = nib.instantiateWithOwner(self, options: nil)[0] as! UIView

        return view
    }
}

The storyboard displays a permanent "Designables Updating".

Designables Updating

Breaking the problem down into a less complex test of only subclassing a UITableViewCell and marking it as @IBDesignable results in the same permanent "Designables Updating".

import UIKit

@IBDesignable class TextFieldTableViewCell: UITableViewCell {

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }

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

}

Has anyone had success with creating a @IBDesignable UITableViewCell subclass? This is happening in Xcode 7 beta 6 and beta 5.

like image 263
Hamer Avatar asked Aug 26 '15 01:08

Hamer


1 Answers

This issue has been resolved as of Xcode 9.

I had reported this issue to Apple and at least have the piece of mind knowing that this is a known bug. It is currently an open issue under the problem ID 17973876.

Edit: As of 12/7/2016 this bug is still marked as open.

like image 132
Hamer Avatar answered Nov 15 '22 23:11

Hamer