美文网首页
3d翻转效果

3d翻转效果

作者: 特特特 | 来源:发表于2016-07-16 16:51 被阅读32次

    项目中对上面的轮播图的需求是要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];

    }

    }

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

    相关文章

      网友评论

          本文标题:3d翻转效果

          本文链接:https://www.haomeiwen.com/subject/ghjujttx.html