3d翻转效果

项目中对上面的轮播图的需求是要3d翻转效果,下面是小弟写的一个demo,没有实现手动滑动效果

#import"ViewController.h"

@interfaceViewController()

@property(weak,nonatomic)IBOutletUIView*picV;

@end

@implementationViewController

- (void)viewDidLoad {

[superviewDidLoad];

UIImageView*iamgeV = [[UIImageViewalloc]initWithFrame:self.picV.bounds];

iamgeV.image= [UIImageimageNamed:@"main-chengyunfang"];

[self.picVaddSubview:iamgeV];

UIImageView*iamgeV1 = [[UIImageViewalloc]initWithFrame:self.picV.bounds];

iamgeV1.image= [UIImageimageNamed:@"main-addguanzhu"];

[self.picVaddSubview:iamgeV1];

UIImageView*iamgeV2 = [[UIImageViewalloc]initWithFrame:self.picV.bounds];

iamgeV2.image= [UIImageimageNamed:@"main-ad"];

[self.picVaddSubview:iamgeV2];

UIImageView*iamgeV3 = [[UIImageViewalloc]initWithFrame:self.picV.bounds];

iamgeV3.image= [UIImageimageNamed:@"main-conghuaminxi"];

[self.picVaddSubview:iamgeV3];

UIImageView*iamgeV31 = [[UIImageViewalloc]initWithFrame:self.picV.bounds];

iamgeV31.image= [UIImageimageNamed:@"main-fabuhuoyuan"];

[self.picVaddSubview:iamgeV31];

NSTimer*timer = [NSTimerscheduledTimerWithTimeInterval:1target:selfselector:@selector(lun)userInfo:nilrepeats:YES];

[timerfire];

}

- (void)lun{

CATransition*trans = [CATransitionanimation];

trans.duration=1;

NSString*subtypes[4] = {kCATransitionFromLeft,kCATransitionFromRight,kCATransitionFromTop,kCATransitionFromBottom};

trans.subtype= subtypes[random() %4];

trans.type=@"cube";

trans.delegate=self;

[self.picV.layeraddAnimation:transforKey:nil];

for(NSIntegeri=1; i<sel.picV.SubuViews; i++) {

[self.picVexchangeSubviewAtIndex:iwithSubviewAtIndex:i-1];

}

}

效果还有很多在研究,欢迎大家补充。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容