是否有可能使用iOS 7 UIViewController转换(具体地交互)与子视图控制器? [英] Is it possible to use iOS 7 UIViewController transitions (interactive specifically) with child view controllers?

查看:103
本文介绍了是否有可能使用iOS 7 UIViewController转换(具体地交互)与子视图控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有许多关于使用新的iOS 7 UIViewController转换API和伟大的新的交互式转换API的教程。然而,这些似乎没有引用添加和删除子视图控制器交互式,尽管在自定义UIViewController转换的WWDC 2013视频中,Apple员工显示了我想象的是一个子视图控制器与自定义转换:

There's many tutorials floating around about using the new iOS 7 UIViewController transitions API and the great new interactive transition API. However, none of these seem to reference adding and removing child view controllers interactively, despite in the WWDC 2013 video on Custom UIViewController Transitions the Apple employee shows what I would imagine to be a child view controller presented with a custom transition:

(我假设这是一个视图控制器显示在另一个看起来的顶部我不认为你可以转换到一个新的UIViewController,而保持其他可见的背后...)

(I'm assuming this as a view controller is shown on top of another one seemingly. I don't think you can transition to a new UIViewController while keeping the other visible behind it...)

有可能实现这样的事情与子视图控制器吗?

Is it possible to achieve such a thing with child view controllers?

在我的具体情况, a UIPageViewController 图像库作为子视图控制器,但您仍然可以看到添加到视图控制器,如果图像 UIPageViewController 不占用全屏。我还添加了在屏幕上滑动图像的能力(类似于iOS 7的多任务关闭),我想这是一个交互式视图控制器弹出。

In my specific situation, I'm adding a UIPageViewController image gallery as a child view controller but you can still see the view controller it was added to if the image the UIPageViewController doesn't take up the full screen. I have also added the ability to slide an image off screen (akin to the iOS 7 multi-tasking close) and I'd love that to be an interactive view controller pop.

有这样的东西的教程吗?是甚么可能?这将更好地用 presentViewController 做,让我可以查看下面的视图控制器?

Are there any tutorials for such a thing? Is it even possible? Would this be better done with presentViewController somehow that would allow me to view the view controller beneath?

推荐答案

如果你再次观看视频,你会注意到在12:15他引用支持的演示风格 UIModalPresentationCustom 。此呈现样式意味着从视图控制器的视图不会从视图层次结构中删除,允许您创建自己的表单。所以在你的case你会做以下:

If you watch the video again you will notice at 12:15 he references the supported presentation style UIModalPresentationCustom. This presentation style means that the 'from' View Controller's View is not removed from the view hierarchy, allowing you to create your own forms. So in your case you would do the following:

//insert code where you want the presentation to begin

UIPageViewController *pageVC = [[UIPageViewController alloc] init];
pageVC.modalPresentationStyle = UIModalPresentationCustom;
id<UIViewControllerTransitioningDelegate> transitionDelegate = [self transitionDelegate];
[self presentViewController:pageVC animated:YES completion:nil];

您的动画过渡对象将负责确保您的页面视图控制器框架不是全屏。只需要注意在屏幕上同时管理两个复杂的视图控制器的影响。我会建议相当采取您的第一个视图控制器视图的快照,然后使它的第二个视图控制器视图的背景。

your animation transition object would be responsible for ensuring that your page view controllers frame is not full screen. Just beware of the implications of managing two complex view controllers on screen at the same time. I would recommend rather taking a snapshot of your first view controllers view and then make it the background of the second view controllers view. The page view controller would then be a child of the second controller.

您可能会发现本教程很有用 - http://www.teehanlax.com/blog/custom-uiviewcontroller-transitions/

You might find this tutorial useful - http://www.teehanlax.com/blog/custom-uiviewcontroller-transitions/

更好的是,有人在github上复制会话218的示例 - https://github.com/soleares / SOLPresentingFun

Better yet, someone made a go at replicating Session 218's sample on github - https://github.com/soleares/SOLPresentingFun

快乐编码

这篇关于是否有可能使用iOS 7 UIViewController转换(具体地交互)与子视图控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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