【发布时间】:2010-11-03 00:03:15
【问题描述】:
有人知道怎么做吗?
我是这么想的:
-(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 中。
有人有什么想法吗?
干杯, 尼克。
【问题讨论】:
-
您实际上不需要覆盖所有那些空的委托方法,只需要覆盖您实际需要使用的那些。调用者应在调用之前测试您的子类是否响应特定方法,无论您是否定义它。这就是代表的工作方式。
标签: iphone cocoa-touch rotation