下载链接:github不断更新地址:https://github.com/gsdios/SDCycleScrollView

#import "ViewController.h"

#import "SDCycleScrollView.h"

@interface ViewController () <</span>SDCycleScrollViewDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {

[super viewDidLoad];

self.view.backgroundColor = [UIColor colorWithRed:0.98green:0.98 blue:0.98 alpha:0.99];

UIImageView *backgroundView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"005.jpg"]];

frame = self.view.bounds;

self.view addSubview:backgroundView];

// 情景一:采用本地图片实现

NSArray *images = @[[UIImage imageNamed:@"h1.jpg"],

UIImage imageNamed:@"h2.jpg"],

UIImage imageNamed:@"h3.jpg"],

UIImage imageNamed:@"h4.jpg"]

];

// 情景二:采用网络图片实现

NSArray *imagesURLStrings = @[

@"https://ss2.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/super/whfpf=425,260,50/sign=a4b3d7085dee3d6d2293d48b252b5910/0e2442a7d933c89524cd5cd4d51373f0830200ea.jpg",

@"https://ss0.baidu.com/-Po3dSag_xI4khGko9WTAnF6hhy/super/whfpf=425,260,50/sign=a41eb338dd33c895a62bcb3bb72e47c2/5fdf8db1cb134954a2192ccb524e9258d1094a1e.jpg",

@"http://c.hiphotos.baidu.com/image/w=400/sign=c2318ff84334970a4773112fa5c8d1c0/b7fd5266d0160924c1fae5ccd60735fae7cd340d.jpg"

];

// 情景三:图片配文字

NSArray *titles = @[@"感谢您的支持,如果下载的",

@"如果代码在使用过程中出现问题",

@"您可以发邮件到gsdios@126.com",

@"感谢您的支持"

];

CGFloat w = self.view.bounds.size.width;

// 本地加载 --- 创建不带标题的图片轮播器

SDCycleScrollView *cycleScrollView = [SDCycleScrollViewcycleScrollViewWithFrame:CGRectMake(0, 100, w, 180)imagesGroup:images];

cycleScrollView.infiniteLoop = YES;

delegate = self;

cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;

self.view addSubview:cycleScrollView];

//         --- 轮播时间间隔,默认1.0秒,可自定义

//cycleScrollView.autoScrollTimeInterval = 4.0;

//网络加载 --- 创建带标题的图片轮播器

SDCycleScrollView *cycleScrollView2 = [SDCycleScrollViewcycleScrollViewWithFrame:CGRectMake(0, 320, w, 180)imageURLStringsGroup:nil]; // 模拟网络延时情景

cycleScrollView2.pageControlAliment =SDCycleScrollViewPageContolAlimentRight;

delegate = self;

titlesGroup = titles;

dotColor = [UIColor yellowColor]; // 自定义分页控件小圆标颜色

placeholderImage = [UIImageimageNamed:@"placeholder"];

self.view addSubview:cycleScrollView2];

模拟加载延迟

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

imageURLStringsGroup = imagesURLStrings;

});

// 清除缓存

//    [cycleScrollView2 clearCache];

}

void)cycleScrollView:(SDCycleScrollView *)cycleScrollView
didSelectItemAtIndex:(NSInteger)index

NSLog(@"---点击了第%ld张图片",
index);

@end

iOS:实现图片的无限轮播之使用第三方库SDCycleScrollView的更多相关文章

  1. iOS实现图片无限轮播之使用第三方库SDCycleScrollView(转)

    下载链接:github不断更新地址:https://github.com/gsdios/SDCycleScrollView #import "ViewController.h" # ...

  2. iOS:实现图片的无限轮播(二)---之使用第三方库SDCycleScrollView

    iOS:实现图片的无限轮播(二)---之使用第三方库SDCycleScrollView 时间:2016-01-19 19:13:43      阅读:630      评论:0      收藏:0   ...

  3. iOS:实现图片的无限轮播---之使用第三方库SDCycleScrollView

    SDCycleScrollView API // //  SDCycleScrollView.h //  SDCycleScrollView #import <UIKit/UIKit.h> ...

  4. iOS开发UI篇—无限轮播(循环利用)

    iOS开发UI篇—无限轮播(循环利用) 一.无限轮播  1.简单说明 在开发中常需要对广告或者是一些图片进行自动的轮播,也就是所谓的无限滚动. 在开发的时候,我们通常的做法是使用一个UIScrollV ...

  5. iOS开发UI篇—无限轮播(新闻数据展示)

    iOS开发UI篇—无限轮播(新闻数据展示) 一.实现效果        二.实现步骤 1.前期准备 (1)导入数据转模型的第三方框架MJExtension (2)向项目中添加保存有“新闻”数据的pli ...

  6. iOS开发UI篇—无限轮播(循环展示)

    iOS开发UI篇—无限轮播(循环展示) 一.简单说明 之前的程序还存在一个问题,那就是不能循环展示,因为plist文件中只有五个数组,因此第一个和最后一个之后就没有了,下面介绍处理这种循环展示问题的小 ...

  7. iOS开发UI篇—无限轮播(功能完善)

    iOS开发UI篇—无限轮播(功能完善) 一.自动滚动 添加并设置一个定时器,每个2.0秒,就跳转到下一条. 获取当前正在展示的位置. [self addNSTimer]; } -(void)addNS ...

  8. iOS:实现图片的无限轮播

    为尊重原创,特注明原文链接:http://m.myexception.cn/operating-system/1949043.html 图片轮播及其无限循环效果 平时APP中的广告位或者滚动的新闻图片 ...

  9. iOS开发之ImageView复用实现图片无限轮播

    在上篇博客中iOS开发之多图片无缝滚动组件封装与使用给出了图片无限轮播的实现方案之一,下面在给出另一种解决方案.今天博客中要说的就是在ScrollView上贴两个ImageView, 把ImageVi ...

随机推荐

  1. UNIX/Linux下C语言的学习路线

    一.工具篇 “公欲善其事,必先利其器”.编程是一门实践性很强的工作,在你以后的学习或工作中,你将常常会与以下工具打交道, 下面列出学习C语言编程常常用到的软件和工具. 1.操作系统    在UNIX或 ...

  2. n&(n-1) n&(-n)

    n&(n-1)   n&(-n) n&(n-1)作用:将n的二进制表示中的最低位为1的改为0,先看一个简单的例子:n = 10100(二进制),则(n-1) = 10011 = ...

  3. zobrist hashing

    Zobrist 哈希是一种专门针对棋类游戏而提出来的编码方式,以其发明者 Albert L.Zobrist 的名字命名.Zobrist 哈希通过一种特殊的置换表,也就是对棋盘上每一位置的各个可能状态赋 ...

  4. redis的简单安装配置

    一.简介 Redis是一种高级key-value数据库,数据可以持久化,支持的数据类型很丰富,有字符串,哈希,链表,集合和有序集合5种数据类型 Redis支持在服务器端计算集合的并,交和补集(diff ...

  5. IIS does not list a website that matches the launch url

    233down voteaccepted I hate answering my questions: in my question i stated that i was running VS un ...

  6. 由IP和掩码计算广播地址

    public static IPAddress GetBroadcast(IPAddress ipAddress, IPAddress subnetMask) { var ip = ipAddress ...

  7. SqlBulkCopy块拷贝数据时,不履行触发器和束缚 解决办法

    在new SqlBulkCopy时,设置SqlBulkCopyOptions属性即可 SqlBulkCopy bulkCopy = new SqlBulkCopy(ConStr,SqlBulkCopy ...

  8. 大数据架构-使用HBase和Solr将存储与索引放在不同的机器上

    大数据架构-使用HBase和Solr将存储与索引放在不同的机器上 摘要:HBase可以通过协处理器Coprocessor的方式向Solr发出请求,Solr对于接收到的数据可以做相关的同步:增.删.改索 ...

  9. Linux常用压缩和解压命令

    .tar 解包 tar xvf filename.tar.tar 打包 tar cvf filename.tar dirname.gz 解压1 gunzip filename.gz.gz 解压2 gz ...

  10. Linux find/grep命令

    一.Find 1)批量删除文件 find . -name "*.h~" -exec rm '{}' \; 2)定位文件某一行 find / -name "demo.con ...