gpt4 book ai didi

ios - 在 iOS 6 中以编程方式调用 willAnimateRotationToInterfaceOrientation

转载 作者:行者123 更新时间:2023-11-29 11:00:43 26 4
gpt4 key购买 nike

在我有其他 viewController 的 viewController 中,在 iOS 5 中,它运行正常,因为它调用了 willAnimateRotationToInterfaceOrientation 方法。如果我旋转设备,iOS 将调用 willAnimateRotationToInterfaceOrientation,并且该应用会正常运行,但当该应用首次启动时,它不会。然后我尝试在 viewWillAppear 中调用 willAnimateRotationToInterfaceOrientation,但它没有帮助。

如何以编程方式或其他方式调用 willAnimateRotationToInterfaceOrientation

最佳答案

willAnimateRotationToInterfaceOrientation:duration: 是仅应由设备调用的几种方法之一。它唯一的特殊之处在于它被调用的时间,因此如果您将其功能提取到另一个方法,您应该能够按您的意愿调用该功能(在本例中,在 viewWillAppear 中)。

-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[self prepareToRotate];
}

-(void)prepareToRotate {
// existing functionality goes here
}

请注意,如果您使用 toInterfaceOrientationduration,您还应该将它们作为参数包含在 prepareToRotate 中。

关于ios - 在 iOS 6 中以编程方式调用 willAnimateRotationToInterfaceOrientation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16015720/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com