You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

207 lines
4.9 KiB

//
// XRCarouselView.h
//
// Created by 肖睿 on 16/3/17.
// Copyright © 2016年 肖睿. All rights reserved.
//
#import <UIKit/UIKit.h>
@class XRCarouselView;
typedef void(^ClickBlock)(NSInteger index);
//pageControl的显示位置
typedef NS_ENUM(NSInteger, PageControlPosition) {
PositionDefault, //默认值 == PositionBottomCenter
PositionHide, //隐藏
PositionTopCenter, //中上
PositionBottomLeft, //左下
PositionBottomCenter, //中下
PositionBottomRight //右下
};
//gif播放方式
typedef NS_ENUM(NSInteger, GifPlayMode) {
GifPlayModeAlways, //始终播放
GifPlayModeNever, //从不播放
GifPlayModePauseWhenScroll //切换图片时不播放
};
//图片切换的方式
typedef NS_ENUM(NSInteger, ChangeMode) {
ChangeModeDefault, //轮播滚动
ChangeModeFade //淡入淡出
};
/**
*
*/
@protocol XRCarouselViewDelegate <NSObject>
/**
*
* block二选一即可block的优先级高
*
* @param carouselView
* @param index
*/
- (void)carouselView:(XRCarouselView *)carouselView clickImageAtIndex:(NSInteger)index;
@end
/**
* C语言函数gif图片
* gif图片请使用该函数创建gif无动画效果
* @param imageName
*/
UIImage *gifImageNamed(NSString *imageName);
/**
* 使imageArray必须设置
* frame必须设置xib\sb创建的可不设置
*
*/
@interface XRCarouselView : UIView
#pragma mark 属性
/**
* ChangeModeDefault
*/
@property (nonatomic, assign) ChangeMode changeMode;
/**
* UIViewContentModeScaleToFill
*/
@property (nonatomic, assign) UIViewContentMode contentMode;
/**
* PositionBottomCenter
* pageControl隐藏
*/
@property (nonatomic, assign) PageControlPosition pagePosition;
/**
* pagePosition无法满足需求
* pagePosition的基础上进行偏移
*/
@property (nonatomic, assign) CGPoint pageOffset;
/**
*
*
*/
@property (nonatomic, strong) UIImage *placeholderImage;
/**
* UIImage
* gif图片gif需做处理后传入
*/
@property (nonatomic, strong) NSArray *imageArray;
/**
*
*
*
*
* nil或空数组
*/
@property (nonatomic, strong) NSArray *describeArray;
/**
* 5s1s
* 1s时
*/
@property (nonatomic, assign) NSTimeInterval time;
/**
* YES
*/
@property (nonatomic, assign) BOOL autoCache;
/**
* gif的播放方式GifPlayModeAlways
*
*/
@property (nonatomic, assign) GifPlayMode gifPlayMode;
/**
*
*/
@property (nonatomic, copy) ClickBlock imageClickBlock;
/**
*
*/
@property (nonatomic, weak) id<XRCarouselViewDelegate> delegate;
#pragma mark 方法
/**
*
*
*/
- (void)startTimer;
/**
*
*
*/
- (void)stopTimer;
/**
*
*
*
*
* @param image
* @param currentImage
*/
- (void)setPageImage:(UIImage *)image andCurrentPageImage:(UIImage *)currentImage;
/**
*
*
*
* @param color
* @param currentColor
*/
- (void)setPageColor:(UIColor *)color andCurrentPageColor:(UIColor *)currentColor;
/**
* nil
*
* @param color [UIColor whiteColor]
* @param font [UIFont systemFontOfSize:13]
* @param bgColor [UIColor colorWithWhite:0 alpha:0.5]
*/
- (void)setDescribeTextColor:(UIColor *)color font:(UIFont *)font bgColor:(UIColor *)bgColor;
/**
*
*/
+ (void)clearDiskCache;
@end