有没有办法使用UIViewAnimationOptionTransitionCurlUp而不用它动画整个屏幕? [英] Is there a way to use UIViewAnimationOptionTransitionCurlUp without it animating the entire screen?

查看:171
本文介绍了有没有办法使用UIViewAnimationOptionTransitionCurlUp而不用它动画整个屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有以下层次结构的视图控制器:

I have a view controller that has the following hierarchy:

UIViewController

|

| -view

     | -presentView(UIView)

     | -stagedView(UIView)

     | -UIToolbar

UIViewController
|
|-view
    |-presentView (UIView)
    |-stagedView (UIView)
    |-UIToolbar

我使用 transitionFromView:toView:duration:options:completion:设置页面动画的方法,可以在 presentView stagedView 之间进行交换。当前和分段视图仅涵盖屏幕的 大多数 ,底部有一个UIToolbar。当我使用 UIViewAnimationOptionTransitionCurlUp 转换时,它会为整个根视图(包括工具栏)设置动画,而不仅仅是所涉及的两个视图。

I am using the transitionFromView:toView:duration:options:completion: method to animate a page curl up to swap between the presentView and the stagedView. The present and staged view only cover most of the screen and there is a UIToolbar at the bottom. When I use the UIViewAnimationOptionTransitionCurlUp transition, it is animating the whole root view (toolbar included), not just the two views involved.

[UIView transitionFromView:self.presentView
                    toView:self.stagedView 
                  duration:0.5f 
                   options:UIViewAnimationOptionTransitionCurlUp
                completion:^ (BOOL finished) {
                                   if (finished) {
                                      // cleanup code
                                   }}];



有没有办法只为两个子视图设置动画,只留下工具栏?如果是这样,怎么样?


推荐答案

我一直在努力解决这个问题,唯一可以解决的问题就是我放了fromView到另一个视图。在您的情况下,视图层次结构应如下所示:

I've been struggling with this issue and the only way I could resolve it is that I put the fromView into another view. In your case the view hierarchy should look like this:


UIViewController
|
|-view
   |-containerView
      |-presentView
   |-stagedView
   |-UIToolBar

fromView 参数仍应指向presentView。希望这会有所帮助。

The fromView parameter still should point to presentView. Hope this helps.

这篇关于有没有办法使用UIViewAnimationOptionTransitionCurlUp而不用它动画整个屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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