图片轮播
查看次数:1592
下载次数:249
上传时间: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];
收藏