• Stars
    star
    1,755
  • Rank 26,530 (Top 0.6 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

a simple and usefull cycle pager view ,and auto scroll banner view(轮播图) ,include pageControl for iOS,support Objective-C and swift

TYCyclePagerView

a simple and usefull cycle pager view ,and auto scroll banner view ,include pageControl for iOS,support Objective-C and swift.this has been used in APP.

CocoaPods

pod 'TYCyclePagerView'

Carthage

github "12207480/TYCyclePagerView"

Requirements

  • Xcode 8 or higher
  • iOS 7.0 or higher
  • ARC

ScreenShot

image

API

  • DataSource and Delegate
@protocol TYCyclePagerViewDataSource <NSObject>

- (NSInteger)numberOfItemsInPagerView:(TYCyclePagerView *)pageView;

- (__kindof UICollectionViewCell *)pagerView:(TYCyclePagerView *)pagerView cellForItemAtIndex:(NSInteger)index;

/**
 return pagerView layout,and cache layout
 */
- (TYCyclePagerViewLayout *)layoutForPagerView:(TYCyclePagerView *)pageView;

@protocol TYCyclePagerViewDelegate <NSObject>

@optional

/**
 pagerView did scroll to new index page
 */
- (void)pagerView:(TYCyclePagerView *)pageView didScrollFromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex;

/**
 pagerView did selected item cell
 */
- (void)pagerView:(TYCyclePagerView *)pageView didSelectedItemCell:(__kindof UICollectionViewCell *)cell atIndex:(NSInteger)index;

// More API see project
  • Class
@interface TYCyclePagerView : UIView

// will be automatically resized to track the size of the pagerView
@property (nonatomic, strong, nullable) UIView *backgroundView; 

@property (nonatomic, weak, nullable) id<TYCyclePagerViewDataSource> dataSource;
@property (nonatomic, weak, nullable) id<TYCyclePagerViewDelegate> delegate;

// pager view layout is important
@property (nonatomic, strong, readonly) TYCyclePagerViewLayout *layout;

/**
 is infinite cycle pageview
 */
@property (nonatomic, assign) BOOL isInfiniteLoop;

/**
 pagerView automatic scroll time interval, default 0,disable automatic
 */
@property (nonatomic, assign) CGFloat autoScrollInterval;


@interface TYCyclePagerViewLayout : NSObject

@property (nonatomic, assign) CGSize itemSize;
@property (nonatomic, assign) CGFloat itemSpacing;
@property (nonatomic, assign) UIEdgeInsets sectionInset;

@property (nonatomic, assign) TYCyclePagerTransformLayoutType layoutType;

@property (nonatomic, assign) CGFloat minimumScale; // sacle default 0.8
@property (nonatomic, assign) CGFloat minimumAlpha; // alpha default 1.0
@property (nonatomic, assign) CGFloat maximumAngle; // angle is % default 0.2


@interface TYPageControl : UIControl

@property (nonatomic, assign) NSInteger numberOfPages;          // default is 0
@property (nonatomic, assign) NSInteger currentPage;            // default is 0. value pinned to 0..numberOfPages-1

// indicatorTint color
@property (nullable, nonatomic,strong) UIColor *pageIndicatorTintColor;
@property (nullable, nonatomic,strong) UIColor *currentPageIndicatorTintColor;

// indicator image
@property (nullable, nonatomic,strong) UIImage *pageIndicatorImage;
@property (nullable, nonatomic,strong) UIImage *currentPageIndicatorImage;

Usage

- (void)addPagerView {
    TYCyclePagerView *pagerView = [[TYCyclePagerView alloc]init];
    pagerView.layer.borderWidth = 1;
    pagerView.isInfiniteLoop = YES;
    pagerView.autoScrollInterval = 3.0;
    pagerView.dataSource = self;
    pagerView.delegate = self;
    // registerClass or registerNib
    [pagerView registerClass:[TYCyclePagerViewCell class] forCellWithReuseIdentifier:@"cellId"];
    [self.view addSubview:pagerView];
    _pagerView = pagerView;
}

- (void)addPageControl {
    TYPageControl *pageControl = [[TYPageControl alloc]init];
    //pageControl.numberOfPages = _datas.count;
    pageControl.currentPageIndicatorSize = CGSizeMake(8, 8);
//    pageControl.pageIndicatorImage = [UIImage imageNamed:@"Dot"];
//    pageControl.currentPageIndicatorImage = [UIImage imageNamed:@"DotSelected"];
//    [pageControl addTarget:self action:@selector(pageControlValueChangeAction:) forControlEvents:UIControlEventValueChanged];
    [_pagerView addSubview:pageControl];
    _pageControl = pageControl;
}
- (void)loadData {
    // load data to _datas
    _pageControl.numberOfPages = _datas.count;
    [_pagerView reloadData];
}

Contact

如果你发现bug,please pull reqeust me
如果你有更好的改进,please pull reqeust me

License

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

More Repositories

1

TYAttributedLabel

TYAttributedLabel 简单,强大的属性文本控件(无需了解CoreText),支持图文混排显示,支持添加链接,image和UIView控件,支持自定义排版显示
Objective-C
2,890
star
2

DOPDropDownMenu-Enhanced

DOPDropDownMenu 添加双列表 优化版 新增图片支持(double tableView, The optimization version ,new add image,detailText)
Objective-C
1,748
star
3

TYPagerController

page scroll view and controller,simple,high custom,and have many tabBar styles,,support Objective-C and swift
Objective-C
1,375
star
4

TYAlertController

Powerful, Easy to use alert view or popup view on controller and window, support blur effects,custom view and animation,for objective-c,support iphone, ipad
Objective-C
1,312
star
5

LovePlayNews

LovePlayNews精仿爱玩iOS app,使用AsyncDisplayKit提高UI流畅性,项目结构及代码清晰明了
Objective-C
668
star
6

TYDownloadManager

Download file manager wrapped NSURLSessionDataTask and NSURLSessionDownloadTask,provide progress update and status change.
Objective-C
412
star
7

TYWaterWaveView

水波浪圆形进度控件,采用 CAShapeLayer,CADisplayLink 波浪动画,简单,流畅
Objective-C
398
star
8

TReaderBook

图文混排阅读器
Objective-C
276
star
9

TYLaunchAnimation

launching image or view Animation,UIView Category,easy to use.(启动图动画,带广告, 直接使用,支持自定义view,自定义动画)
Objective-C
271
star
10

KnowingLife

基于天气,查询,团购,新闻类查询应用,自己自学ios,写的第一个ios项目,也是面试作品,好久没用了,放着可惜,拿来给大家分享,希望给想写个项目,又无处着手的新人帮助,新手作品
Objective-C
140
star
11

TYText

text asynchronous rendering by TextKit for iOS
Objective-C
135
star
12

Prism

Application Performance Management & Monitoring for iOS (APM)
Objective-C
71
star
13

TYSwizzleDemo

method swizzling easy to use ,C Function and NSObject Categary
Objective-C
13
star
14

TYHttpManager

网络请求管理库,基于对AFNetwork的封装
Objective-C
13
star
15

TYDecorationSectionLayout

custom collectionView sections background view (decoration view)
Objective-C
11
star
16

WeiboDemo

Weibo demo using asynchronous rendering by TYText
Objective-C
10
star
17

TYJSONModel

A fast conversion between JSON and Model
Objective-C
7
star
18

BulletAnalyzer

斗鱼弹幕分析工具, 语义近似度合并, CG/CA图表数据绘制, Socket链接
Objective-C
5
star
19

TYPopupController

TYPopupController is presenting view controller or view as popups of other view controller
Objective-C
5
star
20

TYRefresh

a simple way to use pull-to-refresh (上下拉刷新),easy way to customize loading animation(自定义加载动画).
Objective-C
3
star
21

TYBarrageManager

barrage manager view (弹幕)
Objective-C
1
star
22

12207480.github.io

HTML
1
star
23

iOS-Txt-Core

A simple demo for UIPageViewController.
Objective-C
1
star
24

xinWeibo-demo

sina weibo demo 新浪微博 demo
Objective-C
1
star