How do I create a page flip effect programmaticall

2020-06-27 05:25发布

I'm pretty sure I can create a page flip effect using a series of PNGs to simulate the animation but is there a way to do it programmatically? Tried googling it and looking at Apple sample code but didn't see anything addressing that particular animation.

1条回答
聊天终结者
2楼-- · 2020-06-27 06:24

I'm assuming you mean for an iPhone, right?

From the Apple API docs for UIView:

+ (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache

where UIViewAnimationTransition is defined as:

typedef enum {
   UIViewAnimationTransitionNone,
   UIViewAnimationTransitionFlipFromLeft,
   UIViewAnimationTransitionFlipFromRight
   UIViewAnimationTransitionCurlUp,
   UIViewAnimationTransitionCurlDown,
} UIViewAnimationTransition;

UIViewAnimationTransitionCurlUp is what you are looking for. See those docs for information on how to start, set, and commit animations to views as well.

查看更多
登录 后发表回答