AVPlayer layer inside a view does not resize when UIView frame changes

前端 未结 13 856
小蘑菇
小蘑菇 2020-12-23 17:08

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.

<
13条回答
  •  感情败类
    2020-12-23 17:52

    You can change the layer's frame by overriding the -layoutSubviews method:

    - (void)layoutSubviews
    {
        [super layoutSubviews];
        self.playerLayer.frame = self.bounds;
    }
    

提交回复
热议问题