开发者

UIViewAnimationTransitionCurlUp with transparent background

开发者 https://www.devze.com 2023-02-28 23:55 出处:网络
I\'m implementing a fairly standard UIView animation, using UIViewAnimationTransitionCurlUp. The basic idea is that I have a folder on the screen covered with a stack of pages, and as I change from pa

I'm implementing a fairly standard UIView animation, using UIViewAnimationTransitionCurlUp. The basic idea is that I have a folder on the screen covered with a stack of pages, and as I change from page to page I use the curl up animation. Each page is a subview that takes up about 70% of the screen so that the clipboard is still visible in the background.

T开发者_开发百科his animation all works fine, that problem is that even though each "page" (which is a separate UIViewController & UIView) has a transparent background, the page background becomes visible during the page curl. It's only slightly visible, like a black background with an alpha of 0.1. But it ruins the effect.

Any ideas? This is for a private application that will not be distributed on the app store, so private APIs are ok.

UIViewAnimationTransitionCurlUp with transparent background


You will need to change the size of the view of your page view controller to be exactly the size of your page image. It looks from your included image that your page is also rotated. You can apply a rotation to your view to match this rotation. Here is part of the code that I used to achieve the effect in the screenshot:

[self addChildViewController:self.pageViewController];
[self.view addSubview:self.pageViewController.view];

CGRect pageViewRect = CGRectMake(0, 0, 300, 586);
self.pageViewController.view.frame = pageViewRect;
self.pageViewController.view.transform = CGAffineTransformMakeRotation(-M_PI/30);

[self.pageViewController didMoveToParentViewController:self];

UIViewAnimationTransitionCurlUp with transparent background

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号