How to do a flip animation between more than two UIViews?

后端 未结 4 599
闹比i
闹比i 2020-12-29 17:26

I have animation code in a class that extends the UIView:

// Start Animation Block
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimati         


        
相关标签:
4条回答
  • 2020-12-29 17:59

    If you have pointers to the views you're trying to switch between, just call -removeFromSuperview on the "from" view and -addSubview:(the "to" view) on the superview. The transition doesn't rely on any particular method call; more or less any form of the "swap two views" approach will be animated properly.

    0 讨论(0)
  • 2020-12-29 18:05

    Apple have a pretty good tutorial on view transitions here. Other than the way they implement them you can also look at using a UINavigationController which manages a bunch of views and transitioning between them.

    Essentially you need to manage the transition in the superview rather than the view - the superview can know who it's currently displaying and who's next.

    0 讨论(0)
  • 2020-12-29 18:08

    I think a Linked List of views might be what you should think about implementing.

    0 讨论(0)
  • 2020-12-29 18:22

    For those who find this question who are supporting iOS 4.0 and higher, Apple has provided a built-in API for this task:

    See: transitionFromView:toView:duration:options:completion:

    0 讨论(0)
提交回复
热议问题