I have video view (parent) and a nested view with controls (fullscreen button)
I basically am trying to make a fullscreen button where the view rotates and becomes full screen. The parent view does this without any problems, but the child view is not obeying the constraints. It rotates with the parent but the widths and position do not accommodate the transform.
The child view needs to be pinned to leading + trailing + bottom. With a fixed height.
The parent view is also contained within a containing view.
(The videoView is the parent view)
UIView.animate(withDuration: 0.6, animations: {
//Set the default frames ready to restore..
self.videoViewFrame = self.videoView.frame
self.videoViewButtonFrame = self.videoButtonView.frame
self.navigationController?.navigationBar.layer.zPosition = -1
self.navigationController?.setNavigationBarHidden(true, animated: true)
self.tabBarController?.tabBar.layer.zPosition = -1
self.tabBarController?.tabBar.isHidden = true
self.videoView.transform = CGAffineTransform(rotationAngle: CGFloat(M_PI / 2))
self.videoView.frame = UIScreen.main.bounds
UIApplication.shared.keyWindow?.windowLevel = UIWindowLevelStatusBar
}
I have tried different constraint settings.
- Setting the Leading, trailing and bottom
- Setting the equal widths and centre within the videoView parent
The child view rotates with the parent, but not constrained to the bottom, left, right as needed.
Here is the cropped smaller view within the controller (portrait)
Here is the fullscreen, with the controls not pinned as needed

If i log the constraints of the child view, the constraints are still there after the animation. There is no errors within the log either But if i try to change the frame of the child view, it won't let me. It seems the constraints are stuck at the position before the transform takes place? setNeedsLayout or setNeedsUpdateConstraints doesn't change anything
