#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的更多相关文章

  1. python 第三方模块 转 https://github.com/masterpy/zwpy_lst

    Chardet,字符编码探测器,可以自动检测文本.网页.xml的编码. colorama,主要用来给文本添加各种颜色,并且非常简单易用. Prettytable,主要用于在终端或浏览器端构建格式化的输 ...

  2. Java WebSocket库:https://github.com/TooTallNate/Java-WebSocket

    https://github.com/TooTallNate/Java-WebSocket 以下是简单示例: import com.google.gson.JsonObject; import com ...

  3. iOS-启动项目(二)引入第三方库

    摘要 项目中很大几率会用到第三方库,通过 Pod 方式引入第三方库是效率很高的方式,这里介绍一个新的项目搭建 Pod 方式的环境,方便项目中引入第三方库文件. 刚创建的项目中如果需要用到第三方库,常用 ...

  4. iOS 学习笔记 十三 (2015.04.15)采用第三方库,实现ios录音转为amr

    1.第三方开源库地址 https://github.com/guange2015/ios-amr 2.参考博客地址 http://blog.csdn.net/windsoul85/article/de ...

  5. 你一定能用的上的iOS第三方库

    点国内程序员不常用的热门iOS第三方库:看完,还敢自称"精通iOS开发"吗? 综合github上各个项目的关注度与具体使用情况,涵盖功能,UI,数据库,自动化测试,编程工具等类型, ...

  6. iOS第三方库

    热门iOS第三方库:看完,还敢自称”精通iOS开发”吗? 综合github上各个项目的关注度与具体使用情况,涵盖功能,UI,数据库,自动化测试,编程工具等类型,看完,还敢自称”精通iOS开发”吗? h ...

  7. python第三方库,你要的这里都有

    Python的第三方库多的超出我的想象. python 第三方模块 转 https://github.com/masterpy/zwpy_lst   Chardet,字符编码探测器,可以自动检测文本. ...

  8. 一些 iOS 常用的第三方库

    网络通信 AFNetworking 轻量级的通讯类库,使用非常简单.建议更新到最新版,前几天看新闻说之前有个逻辑性的 bug https://github.com/AFNetworking/AFNet ...

  9. ios常用的第三方库

    ios开发中有可能用到的第三方库进行记录一下: 注:资料信息来源于网络 自己整理  https://developer.apple.com/reference(苹果官方文档) https://gith ...

随机推荐

  1. express 学习笔记

    首先把这个库加载下来 npm install -g express 这样会安装它所有依赖包,这个非常恐怖.这个框架要依赖这么多外来的东西,如果有一个不与时俱进就会拖累整个框架的质量. C:\windo ...

  2. [iOS微博项目 - 3.4] - 获取用户信息

    github: https://github.com/hellovoidworld/HVWWeibo   A.获取用户信息 1.需求 获取用户信息并储存 把用户昵称显示在“首页”界面导航栏的标题上   ...

  3. Xcode环境配置mysql

    本文默认mysql安装目录为/usr/local/mysql 在项目的header search paths中添加/usr/local/mysql/includ 2.在项目的library searc ...

  4. 如何防止ASP.NET网站遭受CSRF的攻击

    转载地址: http://www.cnblogs.com/shanyou/p/5038794.html?hmsr=toutiao.io&utm_medium=toutiao.io&ut ...

  5. Objective-C 学习记录6--dictionary

    1.NSDictionary 和NSMutableDictionary NSDictionary dictionaryWithObjectsAndKeys:~,nil 使用键值对创建字典,用nil标志 ...

  6. git/github 使用

    原文:http://www.cnblogs.com/fnng/archive/2011/08/25/2153807.html git/github学习笔记 Posted on 2011-08-25 2 ...

  7. EasyUI ComboBox默认值

    combobox数据加载完后设置默认值 $('#ck').combobox({ url: '/External/GetAllCk', valueField: 'Ddbh', textField: 'D ...

  8. C++成员变量、构造函数的初始化顺序 [转]

    C++成员变量.构造函数的初始化顺序 一.C++成员变量初始化 1.普通的变量:一般不考虑啥效率的情况下 可以在构造函数中进行赋值.考虑一下效率的可以再构造函数的初始化列表中进行 2.static 静 ...

  9. 4.接口隔离原则(Interface Segregation Principle)

    1.定义 客户端不应该依赖它不需要的接口: 一个类对另一个类的依赖应该建立在最小的接口上. 2.定义解读 定义包含三层含义: 一个类对另一个类的依赖应该建立在最小的接口上: 一个接口代表一个角色,不应 ...

  10. oracle 查詢表字段明細、字段注釋、表註釋

    查詢表字段明細 select  column_name,data_type,data_length,DATA_PRECISION ,DATA_SCALE from all_tab_columns wh ...