Disable orientation change rotation animation

后端 未结 5 2162
南方客
南方客 2020-12-01 00:50

I need to disable the animation that plays when the orientation changes. Is this possible? If not, is it possible to speed it up?

Just to clarify, i don\'t want to s

5条回答
  •  悲哀的现实
    2020-12-01 01:45

    Based on Nils Munch's Answer, this is the Swift 3 version:

    override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
        coordinator.animate(alongsideTransition: nil) { (_) in
            UIView.setAnimationsEnabled(true)
        }
        UIView.setAnimationsEnabled(false)
        super.viewWillTransition(to: size, with: coordinator)
    }
    

提交回复
热议问题