源码AdScrollerView,一个已经封装好的UIScrollView的子类,可以自动滚动图片以及对应的描述语,类似淘宝app首页的广告滚动效果。滚动图片数量不限,并且显示pageControl.
效果图:
- <ignore_js_op>
源码下载:
http://code.662p.com/view/9763.html
使用方法:
导入demo中的AdScrollerView文件夹,并导入头文件:
#import "AdScrollView.h"
#import "AdDataModel.h"
示例代码:
AdScrollView * scrollView = [[AdScrollView alloc]initWithFrame:CGRectMake(0, 64, UISCREENWIDTH, 150)];
AdDataModel * dataModel = [AdDataModel adDataModelWithImageNameAndAdTitleArray];
//如果滚动视图的父视图由导航控制器控制,必须要设置该属性(ps,猜测这是为了正常显示,导航控制器内部设置了UIEdgeInsetsMake(64, 0, 0, 0))
scrollView.contentInset = UIEdgeInsetsMake(-64, 0, 0, 0);
NSLog(@"%@",dataModel.adTitleArray);
scrollView.imageNameArray = dataModel.imageNameArray;
scrollView.PageControlShowStyle = UIPageControlShowStyleRight;
scrollView.pageControl.pageIndicatorTintColor = [UIColor whiteColor];
[scrollView setAdTitleArray:dataModel.adTitleArray withShowStyle:AdTitleShowStyleLeft];
scrollView.pageControl.currentPageIndicatorTintColor = [UIColor purpleColor];
[self.view addSubview:scrollView];
注:图片的内容和文字的描述请在AdScrollerView文件夹中的AdDataPlist.plist文件配置,详细请参考Demo.
详细说明: