仅在分割视图控制器的一半上呈现模态视图控制器 [英] Presenting a modal view controller over only one half of a split view controller

查看:101
本文介绍了仅在分割视图控制器的一半上呈现模态视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调整现有的iPhone应用程序以在iPad上运行。在iPhone版本中,当用户点击工具栏按钮时,我会提供一个模态视图控制器,其中 modalTransitionStyle UIModalTransitionStyleFlipHorizo​​ntal ,这是一个非常好的卡片翻转动画。

I'm adapting an existing iPhone app to run on the iPad. In the iPhone version, when the user tapped a toolbar button, I would present a modal view controller with a modalTransitionStyle of UIModalTransitionStyleFlipHorizontal, which made a really nice "card-flipping" animation.

iPad界面基于拆分视图( MGSplitViewController 。工具栏按钮位于详细信息窗格上,因此当我呈现模态视图控制器时,它会占用整个屏幕,并且翻转过渡没有意义。

The iPad interface is based on a split view (MGSplitViewController, actually). The toolbar button is on the detail pane, so when I present the modal view controller, it takes up the entire screen and the flip transition makes no sense.

要获得正确的用户交互,我希望模态控制器在详细视图控制器上显示并翻转到,使主视图控制器保持原样。

To get the right user interaction, I'd like the modal controller to appear and flip into place only over the detail view controller, leaving the master view controller as is.

有没有办法做到这一点?

Is there any way to do this?

推荐答案

UIViewController *viewController = [[UIViewController alloc] init];
viewController.modalPresentationStyle = UIModalPresentationCurrentContext;

[self presentViewController:viewController animated:YES completion:nil];

这篇关于仅在分割视图控制器的一半上呈现模态视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆