I have two views
One is container of AVPlayerLayer like this
containerView.layer.addSublayer(playerLayer)
and containerView has own auto layout about superview
self.view.addSubview(containerView)
containerView.leftAnchor.constraint(equalTo: self.view.leftAnchor).isActive = true
containerView.rightAnchor.constraint(equalTo: self.view.rightAnchor).isActive = true
containerView.topAnchor.constraint(equalTo: self.view.topAnchor).isActive = true
containerView.heightAnchor.constraint(equalToConstant: 300).isActive = true
so i override viewDidLayoutSubviews()
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
playerLayer.frame = containerView.frame
}
and second view is custom playback control view on containerView
containerView.addSubview(playBackControlView)
playBackControlView.leftAnchor.constraint(equalTo: containerView.leftAnchor).isActive = true
playBackControlView.rightAnchor.constraint(equalTo: containerView.rightAnchor).isActive = true
playBackControlView.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true
playBackControlView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor).isActive = true
and there are several views like UIButton
, UISlider
etc
Here is my question
when i tapped one of buttons on playBackControlView
which called enlargeScreenButton
how can make my containerView, playBackControlView and AVPlayerLayer gonna be a full screen like landscape mode at once
I read this question already but only playerLayer changed, not whole view
(I will not device rotation)
I did many thing on Stackoverflow but they were fit on my case
if i transform some views are broken and if i change frame with UIScreen.main.bounds
also it broke some views