CATransition push without fade

前端 未结 4 561
轮回少年
轮回少年 2021-02-04 15:38

I\'m making a navigation controller class for Mac OS X.

I want to replace the current view with a kCATransitionPush animation.
Like in this post:

4条回答
  •  南笙
    南笙 (楼主)
    2021-02-04 16:21

    The best way I've found to get smooth Core Animation transitions that works regardless of whether the view supports CA or not is to do the following:

    1. Create an image of the view you are trying to animate, using NSView -cacheDisplayInRect:toBitmapImageRep or a similar method
    2. Put that image in an NSImageView
    3. Layer back the image view, which will draw fine without glitches when layer backed
    4. Add the image view as a subview over the view that you are trying to transition
    5. Animate the image view frame using NSView's animator proxy
    6. Remove the image view once the animation has completed

提交回复
热议问题