Snapkit,呼叫layoutIfNeeded後x、y為負數。

weixin_33860722發表於2017-08-21

self.contentScrollView.addSubview(self.feedbackBtn) self.feedbackBtn.snp.makeConstraints { (make) in make.top.equalTo(sixLine.snp.bottom).offset(10) make.size.equalTo(CGSize(width: 280, height: 30)) make.centerX.equalTo(self.view) } self.feedbackBtn.titleLabel?.font = UIFont.systemFont(ofSize: FONTSIZE_Content) self.feedbackBtn.setTitle("反饋", for: UIControlState.normal) self.feedbackBtn.primaryStyle() // self.feedbackBtn.layoutIfNeeded() //應該如下 self.contentScrollView.layoutSubviews()

相關文章