失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > iOS 自定义无限循环滚动广告动画控件

iOS 自定义无限循环滚动广告动画控件

时间:2021-01-04 21:37:31

相关推荐

iOS  自定义无限循环滚动广告动画控件

iOS 自定义无限循环广告动画控件

自定义循环滚动的广告控件,支持水平和竖直两个动画方向,页码标记是自定义的,可以随意控制大小位置和颜色等

效果图:

下载地址: /nb-tpl/TPLADShowView

使用方法:

/* tpl 使用方法 */NSMutableArray * showsViewArray = [[NSMutableArray alloc] initWithCapacity:0];for (int i = 0; i < 4; i++){UIImageView * view = [[UIImageView alloc] init];view.backgroundColor = [UIColor colorWithRed:arc4random()%256/255.0f green:arc4random()%256/255.0f blue:arc4random()%256/255.0f alpha:1];[showsViewArray addObject:view];}UIImageView * headBackView = [[UIImageView alloc] initWithFrame:CGRectMake(0,40, self.view.bounds.size.width, 155)];headBackView.userInteractionEnabled = YES;[self.view addSubview:headBackView];_adShowView = [[TPLADShowView alloc] initWithFrame:CGRectMake(0,5, self.view.bounds.size.width, 150) ShowViews:showsViewArray];_adShowView.animationDuration = 2;_adShowView.pageControl.pageIndicatorTintColor = [UIColor colorWithWhite:0.769 alpha:1.000];// _adShowView.pageControl.backgroundColor = [UIColor redColor];_adShowView.pageControl.frame = CGRectMake(10, 5, 15*4, 20);_adShowView.pageControl.pageIndicatorSize = 26.0f;_adShowView.pageControl.currentPage = 0;_adShowView.animationStyle = TPLADShowViewAnimationStyleVertical;[headBackView addSubview:_adShowView];//广告栏点击typeof(self) __weak weak_self = self;_adShowView.clickADView = ^(int clickedIndex){typeof(weak_self) __strong strong_self = weak_self;if (strong_self){NSLog(@"点击了第%d广告",clickedIndex);}};/* tpl 使用方法 */

如果觉得《iOS 自定义无限循环滚动广告动画控件》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。