페이지

2017년 9월 18일 월요일

Setting Custom View Properties

1. add keyword @IBDesignable before class
2. add Keyword @IBInspectable properties

ex ) MyView.swift


@IBDesignable MyView : UIView {

    var titleLabel:UILabel?

   

    @IBInspectable var textColor : UIColor! {

        didSet {

            if self.titleLabel != nil {

                self.titleLabel.textColor = textColor

            }

        }

    }

}