Using Autolayout, everytime I call bringSubviewToFront
, the UIView resets.
I tried setting an original position with txtViewPosition
:
txtViewPosition = CGRect(x: txtView.frame.origin.x, y: txtView.frame.origin.y, width: txtView.frame.size.width, height: txtView.frame.size.height)
containerView.bringSubviewToFront(txtView)
txtView.frame = txtViewPosition!
It looks like the view is the correct position, but it is still showing up in its original spot (set in AutoLayout).
Update (UIView still snaps back)
override func viewDidLayoutSubviews() {
if txtViewPosition != nil {
println("txt position is \(txtViewPosition)")
txtView.frame = txtViewPosition!
}
}