zzyspace / ZYBannerView

简单易用, 显示内容定制性强的可循环轮播控件. 可以实现类似淘宝商品详情中侧拉进入详情页的功能.
MIT License
379 stars 85 forks source link
banner bannerview cycle

CocoaPods  CocoaPods  Support 

ZYBannerView

Features

Usage

Basic Usage

只需简单的2步即可快速集成此控件

1.创建Banner并设置数据源

self.banner = [[ZYBannerView alloc] initWithFrame:CGRectMake(0, 0, 200, 100)];
self.banner.dataSource = self;
[self.view addSubview:self.banner];

2.实现数据源方法

// 返回Banner需要显示Item(View)的个数
- (NSInteger)numberOfItemsInBanner:(ZYBannerView *)banner
{
    return 3;
}

// 返回Banner在不同的index所要显示的View
- (UIView *)banner:(ZYBannerView *)banner viewForItemAtIndex:(NSInteger)index
{
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"xxx"]];
    return imageView;
}

Advanced Usage

各种属性与方法的介绍

Property

NOTE : shouldLoop, showFooter, autoScroll, scrollInterval, dataSource, delegate 均可支持在Storyboard\xib中直接设置

Method

DataSource

Delegate

Requirements

Installation

1.使用CocoaPods:

pod 'ZYBannerView'

2.手动添加:

License

ZYBannerView is released under the MIT license. See LICENSE for details.

ZYBannerView in C

Looking to incorporate ZYBannerView into your project in Xamarin? Check out ZYBannerView_Xamarin (thanks to jingliancui).