1

I have a problem with the view's frame. In the first ViewController inside NavigationBar, I change programmatically orientation of VC. When I push the SecondVC, the SecondVC has a width/height changed, like the width is height and height is the width. It behaves like it didn't have time to reload. In older versions of iOS, there wasn't any problem with it, but the problem appeared in iOS 13...

My code in the FirstVC

override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    UIDevice.current.beginGeneratingDeviceOrientationNotifications()
    UIApplication.shared.isIdleTimerDisabled = false
    UIApplication.shared.keyWindow?.windowLevel = .normal
    let value = UIInterfaceOrientation.portrait.rawValue
    UIDevice.current.setValue(value, forKey: "orientation")
    UIDevice.current.endGeneratingDeviceOrientationNotifications()
}

Thanks for your help

EDIT: I fixed it. I just control, when height > width, if so then I switch height/width. It isn't the best solution but I don't know the better one for now.

Daveloper
  • 606
  • 5
  • 12

0 Answers0