调用未进入UIInterfaceOrientation委托方法,请帮助
以下是代码
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return YES;
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (toInterfaceOrientation == UIInterfaceOrientationPortrait)
{
NSLog(@"potrait");
}
else
{
}
}发布于 2011-02-09 21:39:02
你的视图控制器在另一个视图控制器里面吗?
查找技术问答QA1688为什么我的UIViewController不能与设备一起旋转?在开发人员文档中
这将给你一个提示,为什么它在你的情况下不起作用。
发布于 2011-02-09 21:38:38
上周我遇到了这个问题,这是我发现的。如果您使用的是选项卡栏,则必须具有
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return YES;
}在添加到TabBarController的每个视图控制器中,它们中的任何一个都可以旋转。如果您只想要旋转某些选项卡,您仍然可以通过添加
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
}如果你使用的是NavigationController,可能会有类似的解决方案,但我还没有遇到这个问题。
https://stackoverflow.com/questions/4945319
复制相似问题