Git Product home page Git Product logo

tielan / yjbannerview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from binbear/yjbannerview

0.0 2.0 1.0 31.47 MB

A very popular and highly customized banner view, 无限循环滚动轮播图BannerView、焦点图, 支持Cocoapods 及 Carthage. 支持完全自定义

Home Page: http://blog.csdn.net/hou_manager/article/details/78125071

License: MIT License

Ruby 0.98% Objective-C 98.95% C 0.08%

yjbannerview's Introduction

Logo

Travis Language CocoaPods CocoaPods Carthage Compatible

YJBannerView

  • 使用简单、功能丰富的 Objective-C版 轮播控件, 基于 UICollectionView 实现, 多种场景均支持使用.

效果样例

普通 自定义View

Features

  • 支持自带PageControl样式配置, 也支持自定义
  • 支持上、下、左、右四个方向自动、手动动滚动
  • 支持自动滚动时间设置
  • 支持首尾循环滚动的开关
  • 支持滚动相关手势的开关
  • 支持ContentMode的设置
  • 支持Banner标题的设置自定义
  • 支持自定义UICollectionViewCell
  • 支持在Storyboard\xib中创建并配置其属性
  • 支持非首尾循环的Footer样式和进入详情回调
  • 不依赖其他三方SDWebImage或者AFNetworking设置图片
  • 支持CocoaPods
  • 支持Carthage
  • 支持获取当前位置的自身偏移量

Installation

Cocoapods

YJBannerView is available through CocoaPods. To install it, simply add the following line to your Podfile:

    pod 'YJBannerView'

Carthage

    github "stackhou/YJBannerView"

Usage

1.创建BannerView:

-(YJBannerView *)normalBannerView{
    if (!_normalBannerView) {
        _normalBannerView = [YJBannerView bannerViewWithFrame:CGRectMake(0, 20, kSCREEN_WIDTH, 180) dataSource:self delegate:self placeholderImageName:@"placeholder" selectorString:@"sd_setImageWithURL:placeholderImage:"];
        _normalBannerView.pageControlAliment = PageControlAlimentRight;
        _normalBannerView.autoDuration = 2.5f;
    }
    return _normalBannerView;
}

2.实现数据源方法和代理:

// 将网络图片或者本地图片 或者混合数组
- (NSArray *)bannerViewImages:(YJBannerView *)bannerView{
    return self.imageDataSources;
}

// 将标题对应数组传递给bannerView 如果不需要, 可以不实现该方法
- (NSArray *)bannerViewTitles:(YJBannerView *)bannerView{
    return self.titlesDataSources;
}

// 代理方法 点击了哪个bannerView 的 第几个元素
-(void)bannerView:(YJBannerView *)bannerView didSelectItemAtIndex:(NSInteger)index{
    NSString *title = [self.titlesDataSources objectAtIndex:index];
    NSLog(@"当前%@-->%@", bannerView, title);
}

扩展自定义方法

// 自定义Cell方法
- (Class)bannerViewCustomCellClass:(YJBannerView *)bannerView{
    return [HeadLinesCell class];
}

// 自定义Cell的数据刷新方法
- (void)bannerView:(YJBannerView *)bannerView customCell:(UICollectionViewCell *)customCell index:(NSInteger)index{

    HeadLinesCell *cell = (HeadLinesCell *)customCell;
    [cell cellWithHeadHotLineCellData:@"打折活动开始了~~快来抢购啊"];
}

版本记录

日期 版本号 更新内容
2015-5-10~2016-10-17 1.0~2.0 2.0之前的更新内容没有实际意义,省略...
2016-10-17~2017-01-01 2.0~2.1 功能完善Bug修复等
2017-01-01~2017-07-30 2.1~2.2 主要功能优化,新增FooterView等
2017-7-30~2017-09-30 2.2.0~2.3.0 调优、降低内存消耗等
2017-9-30 2.3.0 调优 创建该控件由原来的120毫秒 优化到只需要60毫秒左右,和创建一个UILabel相当。
2017-11-1 2.3.1 增加停止定时器和重新开启定时器API
2017-11-16 2.3.2 修复当数据为空时刷新后再次有数据刷新不滚动问题
2017-12-05 2.3.4 规范图片加载流程
2017-12-06 2.3.5 区分没有数据的占位图片和图片未加载的占位图片
2017-12-14 2.3.6 数据安全保护和数据更新速度优化
2017-12-15 2.3.7 增加当前滚动位置相对偏移量API
2018-01-18 2.3.8 优化自定义View的实现方式,支持不同位置的Banner自由选择显示类型
2018-06-21 2.3.9 更新 Cocoapods 配置 Source 的修正
2018-07-09 2.4.0 修改手势在iOS 8.1上面的 Crash Bug

性能表现

  • 简单设置时:

  • 复杂设置时:


License

This code is distributed under the terms and conditions of the MIT license.

Change-log

A brief summary of each YJBannerView release can be found in the CHANGELOG.

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.