I updated Xcode 8 and SnapKit 3.0 to test auto layout. I can get frame correct after call layoutIfNeeded
before i update to SnapKit 3.0. But i get frame.origin.x
and .y
both negative value now under SnapKit 3.0.
example:
let signUpView = UIView()
view.addSubview(signUpView)
signUpView.snp.makeConstraints { (make) -> Void in
make.leading.equalTo(50)
make.trailing.equalTo(-50)
make.top.equalTo(topView.snp.bottom)
make.height.equalTo(50)
}
// here frame is: {0,0,0,0}
signUpView.layoutIfNeeded()
// here frame is:
(-137.5, -25.0, 275.0, 50.0)
▿ origin : (-137.5, -25.0)
- x : -137.5
- y : -25.0
▿ size : (275.0, 50.0)
- width : 275.0
- height : 50.0