DKCarouselView 1.4.12

DKCarouselView 1.4.12

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2016

Maintained by Bannings.



  • By
  • Bannings

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

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