uiscrollerview循环滚动(参考第三方库:HMBannerView)https://github.com/iunion/autoScrollBanner
#import <UIKit/UIKit.h>
#import "HMBannerView.h"
@interface ViewController : UIViewController<HMBannerViewDelegate>
// Banner
@property (nonatomic, strong) HMBannerView *bannerView;
@end
#import "ViewController.h"
@interface ViewController ()
@property (strong, nonatomic) IBOutlet UIView *topView;
@end
@implementation ViewController
- (void)dealloc
{
self.bannerView.delegate = nil;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSMutableArray *dataArray = [NSMutableArray arrayWithCapacity:];
NSDictionary *bannerDic = [NSDictionary dictionaryWithObjectsAndKeys:@"http://pic01.babytreeimg.com/foto3/photos/2014/0211/68/2/4170109a41ca935610bf8_b.png", @"img_url", nil];
[dataArray addObject:bannerDic];
bannerDic = [NSDictionary dictionaryWithObjectsAndKeys:@"http://pic01.babytreeimg.com/foto3/photos/2014/0127/19/9/4170109a267ca641c41ebb_b.png", @"img_url", nil];
[dataArray addObject:bannerDic];
bannerDic = [NSDictionary dictionaryWithObjectsAndKeys:@"http://pic02.babytreeimg.com/foto3/photos/2014/0207/59/4/4170109a17eca86465f8a4_b.jpg", @"img_url", nil];
[dataArray addObject:bannerDic];
if (self.bannerView != nil)
{
[self.bannerView reloadBannerWithData:dataArray];
}
else
{
self.bannerView = [[HMBannerView alloc] initWithFrame:CGRectMake(, , _topView.frame.size.width, ) scrollDirection:ScrollDirectionLandscape images:dataArray];
[self.bannerView setRollingDelayTime:1.0];//设置定时时间
[self.bannerView setDelegate:self];
// [self.bannerView setSquare:1];设置边角
[self.bannerView setPageControlStyle:PageStyle_Middle];//分页控件的位置
[self.bannerView startDownloadImage];
[_topView addSubview:self.bannerView];
//[self.bannerView showClose:YES];不显示图片
}
NSMutableArray *dataArray1 = [NSMutableArray arrayWithCapacity:];
NSDictionary *bannerDic1 = [NSDictionary dictionaryWithObjectsAndKeys:@"http://pic05.babytreeimg.com/foto3/photos/2014/0124/88/2/4170109a13aca59db86761_b.png", @"img_url", nil];
[dataArray1 addObject:bannerDic1];
bannerDic1 = [NSDictionary dictionaryWithObjectsAndKeys:@"http://pic01.babytreeimg.com/foto3/photos/2014/0124/18/3/4170109a253ca5b0d88192_b.png", @"img_url", nil];
[dataArray1 addObject:bannerDic1];
HMBannerView *bannerView = [[HMBannerView alloc] initWithFrame:CGRectMake(, , , ) scrollDirection:ScrollDirectionLandscape images:dataArray1];
[bannerView setRollingDelayTime:2.0];
[bannerView setDelegate:self];
[bannerView setSquare:];
[bannerView setPageControlStyle:PageStyle_Left];
[bannerView showClose:YES];
[bannerView startDownloadImage];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark -
#pragma mark HMBannerViewDelegate
- (void)imageCachedDidFinish:(HMBannerView *)bannerView
{
if (bannerView == self.bannerView)
{
if (self.bannerView.superview == nil)
{
[self.view addSubview:self.bannerView];
}
[self.bannerView startRolling];
}
else
{
[self.view addSubview:bannerView];
[bannerView startRolling];
}
}
- (void)bannerView:(HMBannerView *)bannerView didSelectImageView:(NSInteger)index withData:(NSDictionary *)bannerData
{
NSLog(@"bannerdata=%@,index=%d",bannerData,index);
}
- (void)bannerViewdidClosed:(HMBannerView *)bannerView;
{
if (bannerView.superview)
{
[bannerView removeFromSuperview];
}
}
@end

uiscrollerview循环滚动(参考第三方库:HMBannerView)https://github.com/iunion/autoScrollBanner的更多相关文章
- python 第三方模块 转 https://github.com/masterpy/zwpy_lst
Chardet,字符编码探测器,可以自动检测文本.网页.xml的编码. colorama,主要用来给文本添加各种颜色,并且非常简单易用. Prettytable,主要用于在终端或浏览器端构建格式化的输 ...
- Java WebSocket库:https://github.com/TooTallNate/Java-WebSocket
https://github.com/TooTallNate/Java-WebSocket 以下是简单示例: import com.google.gson.JsonObject; import com ...
- iOS-启动项目(二)引入第三方库
摘要 项目中很大几率会用到第三方库,通过 Pod 方式引入第三方库是效率很高的方式,这里介绍一个新的项目搭建 Pod 方式的环境,方便项目中引入第三方库文件. 刚创建的项目中如果需要用到第三方库,常用 ...
- iOS 学习笔记 十三 (2015.04.15)采用第三方库,实现ios录音转为amr
1.第三方开源库地址 https://github.com/guange2015/ios-amr 2.参考博客地址 http://blog.csdn.net/windsoul85/article/de ...
- 你一定能用的上的iOS第三方库
点国内程序员不常用的热门iOS第三方库:看完,还敢自称"精通iOS开发"吗? 综合github上各个项目的关注度与具体使用情况,涵盖功能,UI,数据库,自动化测试,编程工具等类型, ...
- iOS第三方库
热门iOS第三方库:看完,还敢自称”精通iOS开发”吗? 综合github上各个项目的关注度与具体使用情况,涵盖功能,UI,数据库,自动化测试,编程工具等类型,看完,还敢自称”精通iOS开发”吗? h ...
- python第三方库,你要的这里都有
Python的第三方库多的超出我的想象. python 第三方模块 转 https://github.com/masterpy/zwpy_lst Chardet,字符编码探测器,可以自动检测文本. ...
- 一些 iOS 常用的第三方库
网络通信 AFNetworking 轻量级的通讯类库,使用非常简单.建议更新到最新版,前几天看新闻说之前有个逻辑性的 bug https://github.com/AFNetworking/AFNet ...
- ios常用的第三方库
ios开发中有可能用到的第三方库进行记录一下: 注:资料信息来源于网络 自己整理 https://developer.apple.com/reference(苹果官方文档) https://gith ...
随机推荐
- ms-class的进化
ms-class是avalon用得最多的几个绑定之一,也正因为如此其功能一直在扩充中.根据时期的不同,分为旧风格与新风格两种. 旧风格是指正在ms-class后面跟着类外,然后在绑定值中添加表达式,即 ...
- UVALive 7147 World Cup
https://icpcarchive.ecs.baylor.edu/index.phpoption=com_onlinejudge&Itemid=8&page=show_proble ...
- python报错ordinal not in range(128)
python编码问题:'ascii' codec can't decode byte 0xb0 in position 1: ordinal not in range(128) 这种问题有三种原因: ...
- HDU3874Necklace(树状数组+离线操作)
此题的大意思说有一串珠子,每个珠子都有自己的欣赏值value,现在给你一串珠子每个的欣赏值,并给出一些询问,查询某个区间内部总欣赏值是多少,但是有一个约定就是如果这个区间内部有两个珠子的欣赏值是一样的 ...
- myeclipse 8.5安装freemarker插件方法
1. 下载freemarker最新版本,目前本人下载时最新版本是:freemarker-ide-0.9.14.zip, ide版本的freemarker.jar版本太低,可以替换成高级版本,并修改me ...
- Odoo Qweb报表css丢失问题
有时候我们恢复过来的数据库在打印原来系统的Qweb报表的时候会发现所有的样式都丢失了,只打印内容出来. 这时候我们可以进入Setting/ Technical / Paramters / System ...
- python 缩进问题
200 ? "200px" : this.width)!important;} --> 介绍 在python中认为规定4个空格缩进,缩进的代码可以理解成一个块,但是使用缩进也 ...
- android 48dp美化
48dp
- 检索COM 类工厂中CLSID 为 {00024500-0000-0000-C000-000000000046}的组件时失败
在项目中将数据导出为Excel格式时出现“检索COM 类工厂中CLSID 为 {00024500-0000-0000-C000-000000000046}的组件时失败,原因是出现以下错误: 80070 ...
- JS函数的定义与调用方法
JS函数调用的四种方法:方法调用模式,函数调用模式,构造器调用模式,apply,call调用模式 1.方法调用模式:先定义一个对象,然后在对象的属性中定义方法,通过myobject.property来 ...