PageGuo / NewPagedFlowView

电影票卡片式无限自动轮播图
863 stars 181 forks source link
banner carousel flowview

NewPagedFlowView 3.2.1

1.实现了什么功能

2.版本信息

Version 3.2.1:

具体含义请看源代码, 如发现bug请联系:799573715@qq.com (2017-05-08)


Version 3.1.0:

具体含义请看源代码, 如发现bug请联系:799573715@qq.com (2017-02-07)


Version 3.0.0:

具体含义请看源代码, 如发现bug请联系:799573715@qq.com (2016-10-10)


Version 2.0.1:

具体含义请看源代码, 如发现bug请联系:799573715@qq.com (2016-08-30)


Version 1.0.0:

3.动画效果


动图请移步:
http://ww4.sinaimg.cn/mw690/9c6a8c79jw1f6geyiao4tg20a00dc4qu.gif

4.功能介绍

/**
 *  是否开启自动滚动,默认为开启
 */
@property (nonatomic, assign) BOOL isOpenAutoScroll;
/**
 *  是否开启无限轮播,默认为开启
 */
@property (nonatomic, assign) BOOL isCarousel;
/**
 * 左右间距,默认20
 */
@property (nonatomic, assign) CGFloat leftRightMargin;

/**
 * 上下间距,默认30
*/
@property (nonatomic, assign) CGFloat topBottomMargin;

/**
 *  关闭定时器,关闭自动滚动
 */
- (void)stopTimer;

代理方法的使用

@protocol  NewPagedFlowViewDelegate<NSObject>

/**
 *  单个子控件的Size
 *
 *  @param flowView <#flowView description#>
 *
 *  @return <#return value description#>
*/
- (CGSize)sizeForPageInFlowView:(NewPagedFlowView *)flowView;

@optional
/**
 *  滚动到了某一列
 *
 *  @param pageNumber <#pageNumber description#>
 *  @param flowView   <#flowView description#>
 */
- (void)didScrollToPage:(NSInteger)pageNumber inFlowView:(NewPagedFlowView *)flowView;

/**
 *  点击了第几个cell
 *
 *  @param subView 点击的控件
 *  @param subIndex    点击控件的index
 *
 *  @return <#return value description#>
 */
 - (void)didSelectCell:(UIView *)subView withSubViewIndex:(NSInteger)subIndex;

@end

@protocol NewPagedFlowViewDataSource <NSObject>

/**
*  返回显示View的个数
*
*  @param flowView <#flowView description#>
*
*  @return <#return value description#>
*/
- (NSInteger)numberOfPagesInFlowView:(NewPagedFlowView *)flowView;

/**
*  给某一列设置属性
*
*  @param flowView <#flowView description#>
*  @param index    <#index description#>
*  @return <#return value description#>
*/
- (UIView *)flowView:(NewPagedFlowView *)flowView   cellForPageAtIndex:(NSInteger)index;

@end

5.代码示例

NewPagedFlowView *pageFlowView = [[NewPagedFlowView alloc] initWithFrame:CGRectMake(0, 64, Width, (Width - 84) * 9 / 16 + 24)];
pageFlowView.backgroundColor = [UIColor whiteColor];
pageFlowView.delegate = self;
pageFlowView.dataSource = self;
pageFlowView.minimumPageAlpha = 0.4;
pageFlowView.minimumPageScale = 0.85;

//初始化pageControl
UIPageControl *pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(0, pageFlowView.frame.size.height - 24 - 8, Width, 8)];
pageFlowView.pageControl = pageControl;
[pageFlowView addSubview:pageControl];
[pageFlowView startTimer];
[self.view addSubview:pageFlowView];

具体含义请看源代码, Designed By Page,QQ:799573715