iPad&x27;旋转modalView时,s UISPlitView控制器旋转不好
我在iPad&x27;旋转modalView时,s UISPlitView控制器旋转不好,ipad,rotation,uisplitviewcontroller,Ipad,Rotation,Uisplitviewcontroller,我在UISplitViewController上有旋转问题。在我的例子中,在调用splitViewController(此splitViewController是窗口的根视图)上的present model以显示另一个视图之后。旋转该modalView时,splitView旋转不正确 splitView看起来像是旋转的,但是DetailViewController保持它在纵向上的显示,而RootViewController根本没有显示。它的行为仍类似于“纵向”模式。splitView似乎是旋转的
UISplitViewController
上有旋转问题。在我的例子中,在调用splitViewController
(此splitViewController是窗口的根视图)上的present model以显示另一个视图之后。旋转该modalView时,splitView旋转不正确
splitView看起来像是旋转的,但是DetailViewController
保持它在纵向上的显示,而RootViewController
根本没有显示。它的行为仍类似于“纵向”模式。splitView似乎是旋转的,但底层视图没有旋转(DetailViewController
和RootViewController
)
我尝试在modalView上实现willRotateToInterfaceOrientation
,并使用委托调用splitView的willRotateToInterfaceOrientation
方法
这是我在modalView中实现的:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
MacProjectAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.splitViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
}
ModalViewController *modalView = [[ModalViewController alloc] init];
MacProjectAppDelegate *delegate = (MacProjectAppDelegate *)[[UIApplication sharedApplication] delegate];
[delegate.splitViewController presentModalViewController:modalView animated:YES];
[modalView release];
结果是,DetailViewController
行为正确,但与RootViewController
不一致。它一直隐藏着。在用户手动旋转到纵向并返回到横向后,它将重新出现。但显然,用户不希望这样
这就是我在介绍modalView时所做的:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
MacProjectAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.splitViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
}
ModalViewController *modalView = [[ModalViewController alloc] init];
MacProjectAppDelegate *delegate = (MacProjectAppDelegate *)[[UIApplication sharedApplication] delegate];
[delegate.splitViewController presentModalViewController:modalView animated:YES];
[modalView release];
在这种情况下,是否有办法显示RootViewController
?还是我做错了
编辑:
似乎所有视图都没有按照modalView旋转。RootViewController和DetailViewController都没有旋转(两个ViewController上的DidRotateFromoritation根本没有调用)。现在我假设它没有随着设备/modalView旋转。好的。我的问题已经解决了。 我所做的就是写下对舒拉科夫评论的评论 我获取appDelegate并让splitViewController调用willRotateToInterfaceOrientation
MacProjectAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.splitViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
我做了两次,因为其中只有一个似乎不起作用(我不知道为什么)。一个位于modalViewController
的将旋转接口定向
方法,一个位于RootViewController的将出现方法
要删除DetailViewController
上的navigator/popover按钮,我只需在RootViewController
的方法中调用invalidaterootpopooverbuttonItem
即可使该按钮无效。这就是这个特定方法的外观(对于modalViewController
中的第一个方法,我只需将willRotateToOrientation
命令传递给splitViewController
):
希望这能解释我如何克服我的问题,并帮助任何和我有同样问题的人。好的。我的问题已经解决了。
我所做的就是写下对舒拉科夫评论的评论
我获取appDelegate并让splitViewController调用willRotateToInterfaceOrientation
MacProjectAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.splitViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
我做了两次,因为其中只有一个似乎不起作用(我不知道为什么)。一个位于modalViewController
的将旋转接口定向
方法,一个位于RootViewController的将出现方法
要删除DetailViewController
上的navigator/popover按钮,我只需在RootViewController
的方法中调用invalidaterootpopooverbuttonItem
即可使该按钮无效。这就是这个特定方法的外观(对于modalViewController
中的第一个方法,我只需将willRotateToOrientation
命令传递给splitViewController
):
希望这可以解释我如何克服我的问题,并帮助任何与我有相同问题的人。您是否尝试从DetailViewController
而不是直接从UISplitView演示您的modalViewController?我尝试过,但它不起作用。到目前为止,我训练的解决方案是获取appDelegate
,并让splitViewController
调用willrotatetointerfaceooritation
两次。一个位于modalView
的将旋转到接口定向
方法,一个位于RootViewController的将出现方法。但这种方法仍然存在问题DetailViewController
仍会像在纵向模式下一样显示navigator按钮。我还在做这个,我也有同样的问题。看看我的解决方案,您是否尝试过从DetailViewController
而不是直接从UISplitView演示您的modalViewController?我已经尝试过了,但它不起作用。到目前为止,我训练的解决方案是获取appDelegate
,并让splitViewController
调用willrotatetointerfaceooritation
两次。一个位于modalView
的将旋转到接口定向
方法,一个位于RootViewController的将出现方法。但这种方法仍然存在问题DetailViewController
仍会像在纵向模式下一样显示navigator按钮。我还在做这个,我也有同样的问题。看看我的解决方案