baozoudiudiu / Cwcarousel
Licence: mit
轮播图banner
Stars: ✭ 228
Programming Languages
swift
15916 projects
Projects that are alternatives of or similar to Cwcarousel
SRCarouselView
A carousel view that only uses two UIImageView to achieve infinite carousel.
Stars: ✭ 56 (-75.44%)
Mutual labels: carousel, banner
Pagerecyclerview
PageRecyclerView achieves page turning function and unlimited carousel
Stars: ✭ 241 (+5.7%)
Mutual labels: carousel, banner
Kjbannerviewdemo
轮播图无限自动循环滚动、缩放布局、自带缓存加载读取、支持自定义继承、定制特定样式、动态图和网图混合轮播、支持在Storyboard和Xib中创建并配置其属性、多种滚动方向选择、多种分页控件选择等等
Stars: ✭ 206 (-9.65%)
Mutual labels: banner
Slider
Touch swipe image slider/slideshow/gallery/carousel/banner mobile responsive bootstrap
Stars: ✭ 2,046 (+797.37%)
Mutual labels: carousel
Noodel Js
User interface for responsive, dynamic content trees
Stars: ✭ 173 (-24.12%)
Mutual labels: carousel
Zkcarousel
A simple carousel implementation written in Swift
Stars: ✭ 163 (-28.51%)
Mutual labels: carousel
Admobadapter
It wraps your Adapter to display Admob native ads and banners in a ListView/RecyclerView data set. It based on the Yahoo fetchr project https://github.com/yahoo/fetchr
Stars: ✭ 224 (-1.75%)
Mutual labels: banner
Pmalertcontroller
PMAlertController is a great and customizable alert that can substitute UIAlertController
Stars: ✭ 2,397 (+951.32%)
Mutual labels: banner
React Elastic Carousel
A flexible and responsive carousel component for react https://sag1v.github.io/react-elastic-carousel
Stars: ✭ 173 (-24.12%)
Mutual labels: carousel
Vue Glide
A slider and carousel as vue component on top of the Glide.js
Stars: ✭ 225 (-1.32%)
Mutual labels: carousel
React Native Swiper Flatlist
👆 Swiper component implemented with FlatList using Hooks & Typescript + strict automation tests with Detox
Stars: ✭ 217 (-4.82%)
Mutual labels: carousel
Easytipview
Objective-C alternative for EasyTipView implemented in swift
Stars: ✭ 192 (-15.79%)
Mutual labels: banner
Bannerviewpager
🚀 An awesome banner view for Android,Based on ViewPager2. 这可能是全网最好用的ViewPager轮播图。简单、高效,一行代码实现循环轮播,一屏三页任意变,指示器样式任你挑。
Stars: ✭ 2,603 (+1041.67%)
Mutual labels: banner
CWCarousel (建议使用swift版本, swift版本维护频率会比OC高)
基于collectionView实现的通用无限轮播图封装.
- issues里面的可以重现的问题已经修复.
- 部分不能重现的问题暂未处理.
- 请大家提issue尽量描述详细些,最好能提供代码或者截图.请附上是OC版本还是Swift版本的问题.
- 谢谢配合,大家一起进步. 代码示例为oc代码, 项目中已有swift版本,请自行下载. oc版本支持cocoaPods安装
pod search OC_CWCarousel
未来版本计划
- 优化网络图片获取展示逻辑,添加没有请求到网络数据时会显示轮播图缺省样式!
- 重新修改间距算法,并暴露出对应的属性出来,使自定义间距更加简单化!
- 优化timer相关逻辑,争取把controllerWillAppear 和 controllerWillDisAppear 这两个方法干掉。
- 优化自定义pageControl相关逻辑
OC版本记录
版本号 | 更新内容 |
---|---|
1.1.0 | 修复了之前的一些bug |
1.1.1 | 添加了无限轮播功能开关 endless |
1.1.2 | 控件优化 |
1.1.3 | 提升了一个版本号 |
1.1.4 | 修复样式3在320尺寸屏幕上可能出现的问题 |
1.1.5 | 1.新增了2个代理回调 2.点击事件代理回调逻辑优化 |
1.1.7 | 适配iOS14 感谢milletZZ |
swift版本记录
版本号 | 更新内容 |
---|---|
1.1.0 | 功能同OC版 1.1.0 |
1.1.1 | 添加了无限轮播功能开关 endless |
1.1.2 | 修复样式3在320尺寸屏幕上可能出现的问题 |
1.1.3 | 适配swift5.0 |
1.1.4 | 修复通过layout创建视图,偶现不自动轮播问题. |
1.1.7 | 适配iOS14 感谢milletZZ |
1.1.8 | 1.fix bug,2. 自定义pageControl优化, 3.只有一张图时不可无限滑动, 4.无数据时可以设置占位视图 |
- 目前支持4种样式
typedef NS_ENUM(NSUInteger, CWCarouselStyle) {
CWCarouselStyle_Unknow = 0, ///<未知样式
CWCarouselStyle_Normal, ///<普通样式,一张图占用整个屏幕宽度
CWCarouselStyle_H_1, ///<自定义样式一, 中间一张居中,前后2张图有部分内容在屏幕内可以预览到
CWCarouselStyle_H_2, ///<自定义样式二, 中间一张居中,前后2张图有部分内容在屏幕内可以预览到,并且中间一张图正常大小,前后2张图会缩放
CWCarouselStyle_H_3, ///<自定义样式三, 中间一张居中,前后2张图有部分内容在屏幕内可以预览到,中间一张有放大效果,前后2张正常大小
};
CWCarouselStyle_Normal
CWCarouselStyle_H_1
CWCarouselStyle_H_2
CWCarouselStyle_H_3
- 控件实例对象创建
- 创建flowLayout对象,设置轮播图风格
/**
构造方法
@param style 轮播图风格
@return 实例对象
*/
- (instancetype)initWithStyle:(CWCarouselStyle)style;
// egg:
CWFlowLayout *flowLayout = [[CWFlowLayout alloc] initWithStyle:[self styleFromTag:tag]];
- 创建容器对象
/**
创建实例构造方法
@param frame 尺寸大小
@param delegate 代理
@param datasource 数据源
@param flowLayout 自定义flowlayout
@return 实例对象
*/
- (instancetype _Nullable )initWithFrame:(CGRect)frame
delegate:(id<CWCarouselDelegate> _Nullable)delegate
datasource:(id<CWCarouselDatasource> _Nullable)datasource
flowLayout:(nonnull CWFlowLayout *)flowLayout;
// egg:
CWCarousel *carousel = [[CWCarousel alloc] initWithFrame:self.animationView.bounds
delegate:self
datasource:self
flowLayout:flowLayout];
- 注册自定义cell,并实现代理方法,刷新视图
[carousel registerViewClass:[UICollectionViewCell class] identifier:@"cellId"];
[carousel freshCarousel];
#pragma mark - Delegate
// 每个轮播图cell样式
- (UICollectionViewCell *)viewForCarousel:(CWCarousel *)carousel indexPath:(NSIndexPath *)indexPath index:(NSInteger)index{
UICollectionViewCell *cell = [carousel.carouselView dequeueReusableCellWithReuseIdentifier:@"cellId" forIndexPath:indexPath];
/*
your code
*/
return cell;
}
// 点击代理回调
- (void)CWCarousel:(CWCarousel *)carousel didSelectedAtIndex:(NSInteger)index {
NSLog(@"...%ld...", index);
}
// 轮播图个数
- (NSInteger)numbersForCarousel {
return kCount;
}
- 为了流畅性和避免概率图片位置错乱问题,当开启自动滚动时,在banner所处的控制器生命周期中需要调用以下对应方法
/**
轮播图所处控制器WillAppear方法里调用
*/
- (void)controllerWillAppear;
/**
轮播图所处控制器WillDisAppear方法里调用
*/
- (void)controllerWillDisAppear;
- 具体UI样式修改都有具体的属性,详情请查看对应类的.h文件即可.
- 如有问题和bug,欢迎指正.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].