牛叉的demoiOS程序猿iOS Developer

一个无限循环轮播图 HCCycleView

2016-11-02  本文已影响166人  冲破茧缚

功能

演示

创建方式演示 自定义样式演示

使用

详细

 // 创建视图
 HCCycleView *cycleScrollView = [HCCycleView cycleViewWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, 205) delegate:self placeholderImage:PLACEHOLDER_IMAGE];
 // 传入图片数组
 cycleScrollView.imageArrays = imageArr;
 cycleView.imageArrays = imageArr;

自定义PageControl

/***pageControl样式,系统样式和边框样式,默认系统样式*/
@property (nonatomic,assign) HCPageControlType pageControlType;
/***pageControl水平位置,默认居中*/
@property (nonatomic,assign) HCPageControlPosition pageControlPosition;
/***pageControl的dot之间间隔大小*/
@property (nonatomic,assign) CGFloat pageControlDotInterSpace;
/***pageControl的dot的大小*/
@property (nonatomic,assign) CGSize pageControlDotSize;
/***pageControl的dot的边框宽度*/
@property (nonatomic,assign) CGFloat pageControlDotBorderWidth;
/***pageControl的自定义frame*/
@property (nonatomic,assign) CGRect pageControlCustomFrame;
/***pageControl距离底部的距离*/
@property (nonatomic,assign) CGFloat pageControlBottom;
/***pageControl的pageControlColor*/
@property (nonatomic,strong) UIColor *pageControlColor;
/***pageControl的currentPageControlColor*/
@property (nonatomic,strong) UIColor *currentPageControlColor; 

其他属性说明

/*** 自动轮播属性,默认自动轮播 */
@property (nonatomic,assign) BOOL isAutoScroll;
/*** 轮播时间间隔 */
@property (nonatomic,assign) NSTimeInterval timerInterVal;
/*** 图片占位图 */
@property (nonatomic,strong) UIImage *placeholderImage;
/*** 图片数组,支持网络图片和本地图片*/
@property (nonatomic,copy) NSArray *imageArrays;

示例代码


    // 图片数组
    NSArray *imageArr = @[@"http://image72.360doc.com/DownloadImg/2014/04/2301/40991904_7.jpg",
                          @"http://img4.duitang.com/uploads/blog/201406/28/20140628174102_R8Hhd.thumb.700_0.jpeg",
                          [UIImage imageNamed:@"local_image.jpg"],
                          @"http://uploadfile.bizhizu.cn/2014/0507/20140507103639644.jpg",
                          @"http://image55.360doc.com/DownloadImg/2012/10/2517/27773420_5.jpg",
                          @"http://pic62.nipic.com/file/20150303/17961491_092446597000_2.jpg"
                          ];
    
    HCCycleView *cycleScrollView = [HCCycleView cycleViewWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, 205) delegate:self placeholderImage:PLACEHOLDER_IMAGE];
    cycleScrollView.isAutoScroll = NO;
    cycleScrollView.currentPageControlColor = [UIColor whiteColor];
    cycleScrollView.pageControlColor = [UIColor purpleColor];
    cycleScrollView.pageControlType = HCPageControlTypeBorder;
    cycleScrollView.pageControlPosition = HCPageControlPositionRight;
    cycleScrollView.pageControlCustomFrame = CGRectMake(10, 180, 100, 20);
    cycleScrollView.pageControlDotBorderWidth = 1;
    cycleScrollView.pageControlDotInterSpace = 20;
    cycleScrollView.pageControlDotSize = CGSizeMake(10, 10);
    cycleScrollView.imageArrays = imageArr;
    [self.view addSubview:cycleScrollView];
详细示例已放到github:https://github.com/ACoderNHC/HCCycleView
上一篇 下一篇

猜你喜欢

热点阅读