Giter VIP home page Giter VIP logo

jctopic's Introduction

JCTopics

介绍

循环滚动广告图片

继承UIScrollview控制左右滚动。

利用NSTimer控制滚动时间

功能

  1. 无缝滚动
  2. 支持IOS7[ >= IOS6]
  3. 手动和自动
  4. 使用代理回传所点击的数据
  5. 使用代理回传当前页数
  6. 本地图片
  7. 网络图片,异步加载
  8. ARC

使用

//在.h件引入库
#import "JCTopic.h"
//设置代理
@interface ViewController : UIViewController<JCTopicDelegate>
@property(nonatomic,strong)JCTopic * Topic


//在.m  viewDidLoad 加入
//实例化
_Topic = [[JCTopic alloc]initWithFrame:CGRectMake(0, 0, 320, 300)];
//代理
_Topic.JCdelegate = self;
//创建数据
NSMutableArray * tempArray = [[NSMutableArray alloc]init];
//本地图片
//***********************//
//key pic = 本地 UIImage
//key title = 显示的标题 NSString
//key isLoc = 是否本地图片 Bool
//***********************//
UIImage * image = [UIImage imageNamed:@"1.jpg"];
[tempArray addObject:[NSDictionary dictionaryWithObjects:@[image ,@"PIC1",@YES] forKeys:@[@"pic",@"title",@"isLoc"]]];
UIImage * image2 = [UIImage imageNamed:@"2.jpg"];
[tempArray addObject:[NSDictionary dictionaryWithObjects:@[image2 ,@"PIC2",@YES] forKeys:@[@"pic",@"title",@"isLoc"]]];
//网络图片
//***********************//
//key pic = 地址 NSString
//key title = 显示的标题 NSString
//key isLoc = 是否本地图片 Bool
//key placeholderImage = 网络图片加载失败时显示的图片 UIImage
//***********************//
[tempArray addObject:[NSDictionary dictionaryWithObjects:@[@"http://163.54114.com/upimg/allimg/120619/5-120619112512.jpg" ,@"PIC3",@NO] forKeys:@[@"pic",@"title",@"isLoc"]]];
//网络图片加载失败
UIImage * PlaceholderImage = [UIImage imageNamed:@"3.jpg"];
[tempArray addObject:[NSDictionary dictionaryWithObjects:@[@"http://s.doyo.cn/img/52/cf/91779e9e784d2c000003.jpg" ,@"PIC4",@NO,PlaceholderImage] forKeys:@[@"pic",@"title",@"isLoc",@"placeholderImage"]]];

//加入数据
_Topic.pics = tempArray;
//更新
[_Topic upDate];
[self.view addSubview:_Topic];


//设置两个代理方法
//返回当前点击
-(void)didClick:(id)data;
//返回页数
-(void)currentPage:(int)page total:(NSUInteger)total;

image

jctopic's People

Contributors

jeirycheng avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.