2015年6月17日 星期三

客製化調整xib constraint的正確方式

//在其他func中呼叫setNeedsUpdateConstraints(在這以layoutSubviews為例)
override func layoutSubviews() {
        setNeedsUpdateConstraints()
    }

//把你要做的調整放在updateConstraints中
    override func updateConstraints() {
        textViewWidthConstraint.constant = scrollView.frame.width - imageViewWidthConstraint.constant
        super.updateConstraints()
    }

沒有留言:

張貼留言