TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2016 |
Maintained by Bannings.
DKCarouselView is a automatically & circular infinite(or not) scrolling view.The view auto paging/pause can be specified as well.
DKCarouselView *carouselView = [[DKCarouselView alloc] initWithFrame:CGRectMake(0, 0, 320,220)];
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];
[carouselView setAutoPagingForInterval:5];
carouselView.defaultImage = [UIImage imageNamed:@"DefaultImage"];
[self.carouselView setItemClickedBlock:^(DKCarouselItem *item, NSInteger index) {
NSLog(@"%zd",index);
}];
[self.carouselView setItemPagedBlock:^(DKCarouselView *view, NSInteger index) {
NSLog(@"%@, %zd", view, index);
}];
// set infinite slide or not, defaults to NO.
@property (nonatomic, assign, getter = isFinite) BOOL finite;
@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.
/**
* Online Image
*/
@interface DKCarouselURLItem : DKCarouselItem
@property (nonatomic, copy) NSString *imageUrl;
@end
/**
* Custom View
*/
@interface DKCarouselViewItem : DKCarouselItem
@property (nonatomic, strong) UIView *view;
@end
This code is distributed under the terms and conditions of the MIT license