TKCarouselView
TKCarouselView 是一个支持京东和天猫等应用风格的滚动图工具。
示例项目
安装
CocoaPods
- 将
pod 'TKCarouselView'
添加到您的 Podfile 中。 - 运行
pod install
或pod update
。 - 导入 <TKCarouselView.h>。
用法
NSArray *imageNames = @[@"image_name_1.png",@"image_name_2.png",@"image_name_3.png",@"image_name_4.png"];
TKCarouselView *carouselView = [[TKCarouselView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.width/2)];
[self.view addSubview:carouselView];
[carouselView reloadImageCount:imageNames.count itemAtIndexBlock:^(UIImageView *imageView, NSInteger index) {
imageView.image = [UIImage imageNamed:imageNames[index]];
} imageClickedBlock:^(NSInteger index) {
NSLog(@"%@",@(index));
}];
许可证
TKCarouselView 采用 MIT 许可证发布。有关详细信息,请参阅 LICENSE。
中文介绍
TKCarouselView
TKCarouselView 是一款轮播图工具,支持京东、天猫等 App 的样式。
项目演示
安装
CocoaPods
- 将
pod 'TKCarouselView'
添加到您的 Podfile 中。 - 运行
pod install
或pod update
。 - 包含头文件:Import <TKCarouselView.h>。
使用代码
NSArray *imageNames = @[@"image_name_1.png",@"image_name_2.png",@"image_name_3.png",@"image_name_4.png"];
TKCarouselView *carouselView = [[TKCarouselView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.width/2)];
[self.view addSubview:carouselView];
[carouselView reloadImageCount:imageNames.count itemAtIndexBlock:^(UIImageView *imageView, NSInteger index) {
imageView.image = [UIImage imageNamed:imageNames[index]];
} imageClickedBlock:^(NSInteger index) {
NSLog(@"%@",@(index));
}];
许可证
TKCarouselView 采用 MIT 许可证发布。有关详细信息,请参阅 LICENSE。