Underside color of curling view using UIViewAnimationTransitionCurlUp

流过昼夜 提交于 2020-01-23 21:32:06

问题


Can one customize the underside color of curling view in a UIViewAnimationTransitionCurlUp animation. The default seems to be gray/white but i needed a different one.


回答1:


Officially, no.


Unofficially, you can change the color using undocumented methods – but it will cause your app to be rejected if you target for AppStore,

CAFilter* trans_filter = [CAFilter filterWithName:@"pageCurl"];
[trans_filter setValue:[NSArray arrayWithObjects:
                        [NSNumber numberWithFloat:1.0f],  // Red
                        [NSNumber numberWithFloat:0.0f],  // Green
                        [NSNumber numberWithFloat:0.0f],  // Blue
                        [NSNumber numberWithFloat:1.0f],  // Alpha
                        nil] forKey:@"inputColor"];
CATransition* trans = [CATransition animation];
trans.filter = trans_filter;
trans.duration = 2; // etc.
[the_superview_containing_the_transitions.layer addAnimation:trans
                                                      forKey:@"transition"];

[the_old_view removeFromSuperview];
[the_superview_containing_the_transitions addSubview:the_new_view];


来源:https://stackoverflow.com/questions/2019501/underside-color-of-curling-view-using-uiviewanimationtransitioncurlup

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