I have a UIView which contains an AVPlayer to show a video. When changing orientation, I need to change the size and location of the video.
theDunc's answer did not work for me. I found a solution that is more simple: I just needed to adjust the frame of the AVPlayerLayer after changing it in the UIView:
avPlayerLayer.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
In this blog is stated, that a View's frame also affect that of the layer in it.
When you change a view’s frame, it’s simply changing the layer’s frame.
For this case, it is not true.