对无限图片轮播器的封装,一句话代码设置轮播器的属性

本文介绍了一个用于iOS开发的轮播图组件实现方案,包括如何通过代理模式传递图片和标题数组,设置自动轮播等功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 提供给外界的接口:

 

BOOL  isAutoCycle ---是否需要自动轮播

NSArray   imageArray --- 图片数组

NSArray   titleArray --- 文本数组

NSInteger  timeDelay --- 图片轮播延迟 


//代理方法设定的范例

//示例:****- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;

//示例:****- (nullable NSArray<NSString *> *)sectionIndexTitlesForTableView:(UITableView *)tableView


#import <UIKit/UIKit.h>

@class WZHCycleView;


@protocol wzhCycleViewDelegate <NSObject>



@required


/**

 *  外界给轮播器传递图片数组的代理方法

 *

 *  @return 返回一个图片名数组

 */

- (nonnull NSArray<NSString *> *)imageArrayForWZHCycleView;


@optional



/**

 *  外界给轮播器传送label的标题数组代理方法

 *

 *  @return 返回一个label的显示内容的数组

 */

- (nullable NSArray <NSString *> *)titleArrayForWZHCycleView;




@end



@interface WZHCycleView : UIView



@property (weak,nonatomicid <wzhCycleViewDelegate> delegate;


@property (assign,nonatomicCGFloat  timeDelay;


@property (assign,nonatomic,getter=isAutoCycle) BOOL  autoCycle;


@property (assign,nonatomic,getter=isNetImage) BOOL  netImage;





- (nonnull WZHCycleView *)initWithFrame:(CGRect)frame;


+ (nonnull WZHCycleView *)wzhCycleViewWithFrame:(CGRect)frame;




@end


 想看具体demo代码: 点我


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值