#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. quartz中关键类

    job job是一个接口,你对某一类job的定义,可以通过实现该接口来实现.例如为销售报告定义一个SalesReportJob,包含变量name. job可以使用的几个注解 @DisallowConc ...

  2. DELPHI7在WIN8和WIN10下安装和运行

    DELPHI7在WIN8下安装后可以打开运行,但发现设置断点DEBUG运行DLL工程时会卡死(IDE长时间无反应,不报错). DELPHI7在WIN10下安装后打开的时候会报错,无法运行. 以上两种情 ...

  3. scp,ssh双机互信操作步骤

     Node1:# ssh-keygen -t rsa 这一步是生成密钥# ssh-copy-id -i ~/.ssh/id_rsa.pub root@node2.xueping365.com ~/.s ...

  4. 根据路径获得文件名以及Aspose.Cells.dll操作excel 以及使用iTextSharp.text.pdf.PdfReader.dll对PDF的操作

    string result = Regex.Match(str,@"[^\\]+$").Value;//正则表达式 this.listBox1.Items.Add(Path.Get ...

  5. JQuery点击收起,点击展开以及部分非空小验证

    <tr> <td nowrap align="right" width="18%"> 解决方案: </td> <td ...

  6. HDU 3586 Information Disturbing (二分+树形dp)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3586 给定n个敌方据点,1为司令部,其他点各有一条边相连构成一棵树,每条边都有一个权值cost表示破坏 ...

  7. junit学习(3.x)

    自动化测试 测试所有测试类 import junit.framework.TestCase; import junit.framework.Assert; /** *测试类必须要继承TestCase类 ...

  8. AFNetWorking3.0使用 自签名证书的https请求

    前几日,项目组出于安全角度的考虑,要求项目中的请求使用https请求,因为是企业内部使用的app,因此使用了自签名的证书,而自签名的证书是不受信任的,所以我们就需要自己来做证书的验证,包括服务器验证客 ...

  9. Sending messages to non-windowed applications -- AllocateHWnd, DeallocateHWnd

    http://delphi.about.com/od/windowsshellapi/l/aa093003a.htm Page 1: How Delphi dispatches messages in ...

  10. CMSIS-DAP调试器

    http://www.keil.com/support/man/docs/dapdebug/dapdebug_introduction.htm CMSIS-DAP is the interface f ...