Git Product home page Git Product logo

dkcarouselview's Introduction

DKCarouselView

infinite scrolling

GIF

finite scrolling

GIF

custom view

GIF

adapting

GIF

Overview

DKCarouselView is a automatically & circular infinite(or not) scrolling view.The view auto paging/pause can be specified as well.

How To Get Started

Installation with CocoaPods

$ pod search DKCarouselView

-> DKCarouselView (1.4.6)
   A automatically & circular infinite scrolling view.
   pod 'DKCarouselView', '~> 1.3.0'
   - Homepage: https://github.com/zhangao0086/DKCarouselView
   - Source:   https://github.com/zhangao0086/DKCarouselView.git
   - Versions: 1.0.1 [master repo]

Edit your Podfile and add DKCarouselView:

pod 'DKCarouselView', '~> x.x.x'

Add #import "DKCarouselView.h" to the top of classes that will use it.

Create instances (Also supports xib/storyboard)
DKCarouselView *carouselView = [[DKCarouselView alloc] initWithFrame:CGRectMake(0, 0, 320,220)];
Setup items
NSArray *images = @[@"https://c1.staticflickr.com/9/8428/7855079606_5fc8852562_z.jpg",
                    @"http://upload.wikimedia.org/wikipedia/commons/thumb/8/8f/Parang_mountain_image_1.jpg/640px-Parang_mountain_image_1.jpg",
                    @"http://www.openjpeg.org/samples/Bretagne1.bmp",
                    @"http://blog.absolutvision.com/wp-content/uploads/2009/10/Gimp_2.6b.jpg"
                    ];
NSMutableArray *items = [NSMutableArray new];
for (NSString *imageUrl in images) {
    DKCarouselURLItem *urlAD = [DKCarouselURLItem new];
    urlAD.imageUrl = imageUrl;
    
    [items addObject:urlAD];
}
[carouselView setItems:items];
Auto paging for 5 seconds
[carouselView setAutoPagingForInterval:5];
Placeholder for online images
carouselView.defaultImage = [UIImage imageNamed:@"DefaultImage"];
Callback
[self.carouselView setItemClickedBlock:^(DKCarouselItem *item, NSInteger index) {
    NSLog(@"%zd",index);
}];
[self.carouselView setItemPagedBlock:^(DKCarouselView *view, NSInteger index) {
    NSLog(@"%@, %zd", view, index);
}];
Finite or not
// set infinite slide or not, defaults to NO.
@property (nonatomic, assign, getter = isFinite) BOOL finite;
Indicator style
@property (nonatomic, strong) UIColor *indicatorTintColor;
@property (nonatomic, assign) CGPoint indicatorOffset; // default offset is CGPointZero, the indicator is centered horizontally.
@property (nonatomic, readonly) CGSize indicatorSize; // returns minimum size for given items.
DKCarouselURLItem Or DKCarouselViewItem
/**
 *  Online Image
 */
@interface DKCarouselURLItem : DKCarouselItem

@property (nonatomic, copy) NSString *imageUrl;

@end

/**
 *  Custom View
 */
@interface DKCarouselViewItem : DKCarouselItem

@property (nonatomic, strong) UIView *view;

@end

License

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

Special Thanks

jiyee

dkcarouselview's People

Contributors

evayuhz avatar jiyee avatar manijak avatar qclmnt avatar sitefinitysteve avatar zhangao0086 avatar

Watchers

 avatar  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.