page curl animation with transparent UIImageView (iOS)

寵の児 提交于 2019-12-23 12:27:44

问题


I have a ribbon (bookmark) that I want to curl up, off of the screen. The ribbon has a V cut out of the bottom, which is a transparent section - a UIImageView with a transparent png.

When I perform a curl on the ribbon, the underlying shadow represents the entire View (which is technically square). I am trying to make this look as real as possible so if someone could point me in the right direction, that would be helpful.

I have tried - masking the view - tweaking open source page curl frameworks - replacing the viewAtIndex during a page curl - UIView animations

but they all result in a square shadow.

The best experience I can provide so far is a simple UIView animation while fading out the:

[UIView transitionWithView:_ribbonButton
                       duration:0.5f 
                        options:UIViewAnimationOptionTransitionCurlUp
                     animations:^{
                         [_ribbonButton setAlpha:0.0f];
                     } 
                     completion:^(BOOL completed){
                         [self animationCompleted:completed];
                     }];    

Here is an screenshot: http://livevision.us/wordpress/?attachment_id=60


回答1:


I don't think that will be possible using UIViewAnimationOptionTransitionCurlUp. The view animations are based on the entire view bounds, not the contents of the view.

I think you will have to code something yourself in OpenGL or a pre-rendered flip animation or something else. There are a number of existing OpenGL solutions you can download and customize.



来源:https://stackoverflow.com/questions/8767274/page-curl-animation-with-transparent-uiimageview-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!