Snapkit,调用layoutIfNeeded后x、y为负数。

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()

你可能感兴趣的:(Snapkit,调用layoutIfNeeded后x、y为负数。)