項(xiàng)目中對(duì)上面的輪播圖的需求是要3d翻轉(zhuǎn)效果酵颁,下面是小弟寫(xiě)的一個(gè)demo赦邻,沒(méi)有實(shí)現(xiàn)手動(dòng)滑動(dòng)效果
#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];
}
}
效果還有很多在研究抵栈,歡迎大家補(bǔ)充胜茧。