/ScrollPageView

将ScrollView与SMPageControl结合,依据MVC模式构建类,简化调用难度,依赖库是SMPageControl,可以使用Pod导入

Primary LanguageObjective-CMIT LicenseMIT

ScrollPageView

//定义所需要的变量
@property (weak, nonatomic) IBOutlet UIView *autoPlayView;
@property (nonatomic, strong) DDScrollPageView * pageView;
@property (nonatomic, strong) NSArray * viewArray;

//创建ScrollPageView
self.pageView=[[DDScrollPageView alloc] initWithFrame:self.autoPlayView.frame];
self.pageView.pageControlOffsetY=-30;
self.pageView.interval=2.0;
self.pageView.isAutoPlay=YES;
self.pageView.isCycle=YES;
self.pageView.dataSource=self;
[self.pageView setPageIndicatorImage:[UIImage imageNamed:@"灰点"] andCurrentPageIndicatorImage:[UIImage imageNamed:@"banner点"]];
[self.autoPlayView addSubview:self.pageView];
[self.pageView reloadData];

//实现代理
#pragma mark DDScrollPageViewDataSource
-(NSInteger)numberOfViewsInScrollPageView:(DDScrollPageView *)scrollPageView{
return self.viewArray.count;

}
-(UIView *)scrollPageView:(DDScrollPageView *)scrollPageView viewForIndex:(NSInteger)index{
return self.viewArray[index];
}