3

I have a custom view that have a label and text field and was connected to my nib file.

I want to edit them using attribute inspector, but the only component that I see on the attribute inspector was the parent UIView

How can I show the whole inspectable of the UILabel and UITextField in the attribute inspector?

@IBDesignable
class CustomView: UIView {
    @IBOutlet weak var label: UILabel!
    @IBOutlet weak var textField: ChimeTextField!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.configureView()
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
        self.configureView()
    }
    
    private func configureView() {
        guard let view = self.loadViewFromNib(nibName: "CustomView") else { return }
        view.frame = self.bounds
        self.addSubview(view)
    }

}
Dylan
  • 1,121
  • 1
  • 13
  • 28
  • Guess this blog post can help: https://nshipster.com/ibinspectable-ibdesignable/ – wzso Aug 05 '20 at 01:53
  • why you want to do that ? as you can select that label and can have access all the attributes there ... once you have outlet you don't need `@IBInspectable` because `outlet` is a bigger set of attributes then `@IBInspectable` – Jawad Ali Aug 05 '20 at 05:01

0 Answers0