Files
keyboard/keyBoard/Class/Base/V/UIScrollView+KBEmptyView.h
2025-11-10 15:29:21 +08:00

40 lines
1.5 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// UIScrollView+KBEmptyView.h
// keyBoard
//
// 统一封装基于 LYEmptyView 的空态视图挂载方法,适用于 UITableView/UICollectionView。
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef void(^KBEmptyAction)(void);
@interface UIScrollView (KBEmptyView)
/// 快速挂载一套统一样式的空态视图LYEmptyView
/// - Parameters:
/// - image: 占位图(可空)
/// - title: 标题(默认“暂无数据”)
/// - detail: 描述(可空)
/// - buttonTitle: 按钮标题(可空,传空则不显示按钮)
/// - tapHandler: 点击空白区域回调(可空)
/// - buttonHandler: 按钮点击回调(可空)
- (void)kb_makeDefaultEmptyViewWithImage:(nullable UIImage *)image
title:(nullable NSString *)title
detail:(nullable NSString *)detail
buttonTitle:(nullable NSString *)buttonTitle
tapHandler:(nullable KBEmptyAction)tapHandler
buttonHandler:(nullable KBEmptyAction)buttonHandler;
/// 便捷加载态控制:关闭自动显隐后,配合网络请求手动控制显示/隐藏
- (void)kb_setLYAutoShowEnabled:(BOOL)enabled; // YES=自动显隐NO=手动
- (void)kb_beginLoadingForEmpty; // 请求开始:临时隐藏 empty
- (void)kb_endLoadingForEmpty; // 请求结束:根据数据源显示/隐藏(需确保先 reloadData
@end
NS_ASSUME_NONNULL_END