gpt4 book ai didi

iphone - 横向模式的 curl 效果

转载 作者:行者123 更新时间:2023-11-28 20:36:05 25 4
gpt4 key购买 nike

我正在尝试使用以下代码片段实现 curl 效果

蜷缩起来

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.95];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown
forView:self.view cache:YES];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView setAnimationDelegate:self];

蜷缩起来

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.95];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
[UIView setAnimationDelegate:self];

但这适用于纵向模式。

我想在横向模式下实现它,点击右上角和左下角。

目前它的作用是相反的。

非常感谢

最佳答案

#import <QuartzCore/QuartzCore.h>

-(void)pageCurltoNextorPrevious:(UIView*)view:(int)identifier {

// Curl the image up or down
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:1.0];
CAMediaTimingFunction *fun=[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[animation setTimingFunction:fun];


if (identifier==1){
//next animation
animation.type = @"pageCurl";
animation.subtype=@"fromRight";
animation.fillMode = kCAFillModeForwards;
animation.endProgress = 1.0; //0.58;
}
else {
//previous animation
animation.type = @"pageCurl";
animation.subtype=@"fromLeft";
animation.fillMode = kCAFillModeBackwards;
animation.startProgress = 0.0;
}
[animation setRemovedOnCompletion:NO];

//[view exchangeSubviewAtIndex:0 withSubviewAtIndex:2];

[[view layer] addAnimation:animation forKey:@"pageCurlAnimation"];
}

关于iphone - 横向模式的 curl 效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10468227/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com