代码库> 滚动视图> 图片轮播
图片轮播
关注
上传者:秦传龙 分类:滚动视图(Scrollview)
查看次数:1171 下载次数:232
上传时间:2016-09-09 大小:3 KB
当点击进入下一个页面时 你可以把图片轮播关闭 避免定时器一直开启 下面是这两个方法可以控制
/**
* 停止播放
*/
- (void)stop;


/**
* 开始播放
*/
- (void)start;




CGRect frame = CGRectMake(0, 100, self.view.frame.size.width, 200);

NSArray *imageArr = @[@"1.jpg",@"2.png",@"3.jpg",@"4.jpg",@"1.jpg",@"2.png",@"3.jpg",@"4.jpg",@"1.jpg",@"2.png",@"3.jpg",@"4.jpg"];

CLCycleView *cycleView = [[CLCycleView alloc] initWithFrame:frame duration:3 imageArr:imageArr];
cycleView.delegate = self;
cycleView.currentPageIndicatorTintColor = [UIColor redColor];
cycleView.pageIndicatorTintColor = [UIColor blueColor];
cycleView.diameter = 20;
cycleView.cycleView = ^(NSInteger indexPage) {
NSLog(@"block显示点击%ld张图片",indexPage);
};

self.cycleView = cycleView;
[self.view addSubview:cycleView];

// 或者用代理方法控制点击的某张图片
CGRect frame = CGRectMake(0, 100, self.view.frame.size.width, 200);

NSArray *imageArr = @[@"1.jpg",@"2.png",@"3.jpg",@"4.jpg",@"1.jpg",@"2.png",@"3.jpg",@"4.jpg",@"1.jpg",@"2.png",@"3.jpg",@"4.jpg"];

CLCycleView *cycleView = [[CLCycleView alloc] initWithFrame:frame duration:3 imageArr:imageArr];
cycleView.delegate = self;
cycleView.currentPageIndicatorTintColor = [UIColor redColor];
cycleView.pageIndicatorTintColor = [UIColor blueColor];
cycleView.diameter = 20;
cycleView.cycleView = ^(NSInteger indexPage) {
NSLog(@"block显示点击%ld张图片",indexPage);
};

self.cycleView = cycleView;
[self.view addSubview:cycleView];
收藏
我来说两句
发表评论
您还没有登录!请登录注册
所有评论(0
提示
sina weixin mail 回到顶部