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 ...
随机推荐
- HDU3874Necklace(树状数组+离线操作)
此题的大意思说有一串珠子,每个珠子都有自己的欣赏值value,现在给你一串珠子每个的欣赏值,并给出一些询问,查询某个区间内部总欣赏值是多少,但是有一个约定就是如果这个区间内部有两个珠子的欣赏值是一样的 ...
- java -X 这不是标准的选项只是为了获取帮助信息
-? -help 输出此帮助消息 获取帮助信息方式有三种: java java -? java -help -X 输出非标准选项的帮助 java -X -Xms< ...
- thinkphp显示重复两次
在index.php中去掉 //App::run(); 这种方式是原来的旧版本的方式,现有版本的Thinkphp已经改变,不需要输入此行即可运行.
- [置顶] Linux信号相关笔记
最近又温习了一遍Linux中的信号知识,发现有很多东西以前没有注意到,就通过这篇博客记录一下,巩固一下知识点. 一,信号基础: 信号是什么?为了回答这个问题,首先要从异常说起,这里的异常不是指c++/ ...
- Lync2010升级到2013之账户启用!
打开ADUC,将用户添加到 csadministrator 组中:
- PHP中关于超链接的拼接问题
<?php$link = " http://www.baidu.com";echo '<a href='.$link.'> 百度 </a>';?> ...
- PL/pgSQL学习笔记之八
http://www.postgresql.org/docs/9.1/static/plpgsql-declarations.html 另外一种声明 PL/pgSQL 函数的方法是使用 returns ...
- C++学习笔记之数据类型
一.变量名 几条简单的C++命名规则: 在名称中只能使用字母,数字和下划线 名称的第一个字符不能是数字 区分大小写 不能将C++关键字用作名称 以两个下划线和大写字母打头的名称被保留给实现(编译器及其 ...
- Immutable.js尝试(node.js勿入)
最近做一些复杂html常常需要在页面做一些数据处理,常常在想如果 js有list 这种数据结构多少,今天逛github时 发现有Immutable.js 这个项目https://github.com/ ...
- C#反射深入学习
C#反射 反射(Reflection)是.NET中的重要机制,通过放射,可以在运行时获得.NET中每一个类型(包括类.结构.委托.接口和枚举等)的成员,包括方法.属性.事件,以及构造函数等.还可以获得 ...