旋转变化不再触发

时间:2016-01-29 10:23:36

标签: ios swift orientation

我有一个带有viewcontroller的应用程序。 我已经覆盖了以下方法:

override func didRotateFromInterfaceOrientation(fromInterfaceOrientation: UIInterfaceOrientation) {

override func willRotateToInterfaceOrientation(
        toInterfaceOrientation: UIInterfaceOrientation,
        duration: NSTimeInterval) {

override func willAnimateRotationToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) {

override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {

override func shouldAutorotate() -> Bool未实施。

我正在将我的设备从纵向旋转到横向,但没有触发任何方法。我知道我的viewWillTransitionToSize是昨天触发的,但现在它没有。我不明白可能是什么原因。

我没有看到关于旋转检测的任何改变。

有人有提示吗?

更新

抱歉大众。这是我的愚蠢失败。 我有一个实现了viewWillTransitionToSize的父uiviewcontroller,忘了调用super,所以它也会识别我的子视图中的旋转。

哦,我很抱歉所有人都浪费时间。 非常感谢。

2 个答案:

答案 0 :(得分:0)

您可以使用

- (NSUInteger)应用程序:(UIApplication *)应用程序supportedInterfaceOrientationsForWindow:Appdelegate中的(UIWindow *)窗口

答案 1 :(得分:0)

抱歉大众。这是我的愚蠢失败。我有一个实现viewWillTransitionToSize的父uiviewcontroller,忘了调用super,所以它也会识别我的子视图中的旋转。