任何人都知道如何做到這一點?如何在沒有設備自動旋轉的情況下檢測iPhone上的旋轉?
我想這:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
}
- (void)willAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
}
- (void)didAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
}
- (void)willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation duration:(NSTimeInterval)duration {
}
可以防止旋轉裝置(覆蓋所有轉動我的UIViewController的方法,而不是調用父類),但我擔心它不是實際執行旋轉的UIViewController。
我的UIViewController位於UINavigationController中。
任何人有任何想法?
乾杯, Nick。
實際上,您不應該重寫所有那些空的委託方法,而只需要實際需要使用的方法。無論您是否定義它,調用者都應該測試您的子類在調用它之前是否響應某個特定的方法。這只是代表工作的方式。 – 2009-06-15 17:01:41