iOS 广告等图片展示轮播,支持无限循环播放


GCCycleScrollView用于iOS 广告等图片展示轮播,支持无限循环播放,以及拖拽功能.GCCycleScrollView对于每一张图片都可以添加自己的标题以及设置标题label的相关属性或者使用默认的设置。

GCCycleScrollView

https://github.com/wheying/GCCycleScrollView

Picture(图片效果)

test.gif

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation(安装)

GCCycleScrollView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "GCCycleScrollView"

Manual Install(手动导入)

Download the Project and then drag "lib"file to your own project.首先下载该项目,把项目中的lib文件夹拉入自己的项目。

#import "GCCycleScrollView.h"

Example(例子)

=====
load local images 本地图片加载

    //load local images 本地图片加载
    GCCycleScrollView *cycleScroll = [[GCCycleScrollView alloc] initWithFrame:CGRectMake(0, 80, self.view.frame.size.width, 170)];
    cycleScroll.delegate =self;
    NSArray *images = [[NSArray alloc] initWithObjects:[UIImage imageNamed:@"3"],[UIImage imageNamed:@"1"],[UIImage imageNamed:@"5"],[UIImage imageNamed:@"2"],nil];
    cycleScroll.localImageGroups = images;
    cycleScroll.autoScrollTimeInterval = 3.0;
    cycleScroll.dotColor = [UIColor greenColor];
    [self.view addSubview:cycleScroll];

load images from website 网络图片加载

//load images from website 网络图片加载
    GCCycleScrollView *cycleScroll = [[GCCycleScrollView alloc] initWithFrame:CGRectMake(0, 300, self.view.frame.size.width, 170)];
    cycleScroll.delegate =self;
    NSArray *urlimages = [[NSArray alloc] initWithObjects:@"http://pics.sc.chinaz.com/files/pic/pic9/201603/apic19563.jpg",@"http://pics.sc.chinaz.com/files/pic/pic9/201603/apic19747.jpg",@"http://pics.sc.chinaz.com/files/pic/pic9/201603/apic19515.jpg",@"http://pics.sc.chinaz.com/files/pic/pic9/201602/apic18951.jpg",nil];
    cycleScroll.imageUrlGroups = urlimages;
    cycleScroll.autoScrollTimeInterval = 3.0;
    cycleScroll.dotColor = [UIColor greenColor];
    [self.view addSubview:cycleScroll];

clear image data cache清除图片本地缓存

//clear image data cache清除图片缓存
[cycleScroll clearCache];

pageControll location; pageControll的位置

//pageControll location; pageControll的位置
typedef NS_ENUM(NSInteger,GCCycleScrollPageControlAliment){
    /**
     *  page control 位于中间,默认在中间 center default value
     */
    GCCycleScrollPageControlAlimentCenter = 0,
    
    /**
     *  page control 位于右侧 right side
     */
    GCCycleScrollPageControlAlimentRight = 1,
    
    /**
     *  page control 位于左侧 left side
     */
    GCCycleScrollPageControlAlimentLeft = 2
};
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容