FWEmptyView
@interface FWEmptyView : UIView
通用的空界面控件,布局顺序从上到下依次为:imageView, loadingView, textLabel, detailTextLabel, actionButton
-
此控件通过设置 loadingView.hidden 来控制 loadinView 的显示和隐藏,因此请确保你的loadingView 没有类似于 hidesWhenStopped = YES 之类会使 view.hidden 失效的属性
Declaration
Objective-C
@property (nonatomic, strong) UIView<FWIndicatorViewPlugin> *_Nonnull loadingView;
-
图片控件
Declaration
Objective-C
@property (nonatomic, strong, readonly) UIImageView *_Nonnull imageView;
-
文本控件
Declaration
Objective-C
@property (nonatomic, strong, readonly) UILabel *_Nonnull textLabel;
-
详细文本控件
Declaration
Objective-C
@property (nonatomic, strong, readonly) UILabel *_Nonnull detailTextLabel;
-
动作按钮控件
Declaration
Objective-C
@property (nonatomic, strong, readonly) UIButton *_Nonnull actionButton;
-
更多动作按钮控件,默认隐藏
Declaration
Objective-C
@property (nonatomic, strong, readonly) UIButton *_Nonnull moreActionButton;
-
内容视图间距,默认为(0, 16, 0, 16)
Declaration
Objective-C
@property (nonatomic) UIEdgeInsets contentViewInsets;
-
图片视图间距,默认为(0, 0, 36, 0)
Declaration
Objective-C
@property (nonatomic) UIEdgeInsets imageViewInsets;
-
加载视图间距,默认为(0, 0, 36, 0)
Declaration
Objective-C
@property (nonatomic) UIEdgeInsets loadingViewInsets;
-
文本视图间距,默认为(0, 0, 10, 0)
Declaration
Objective-C
@property (nonatomic) UIEdgeInsets textLabelInsets;
-
详细文本视图间距,默认为(0, 0, 10, 0)
Declaration
Objective-C
@property (nonatomic) UIEdgeInsets detailTextLabelInsets;
-
动作按钮间距,默认为(0, 0, 0, 0)
Declaration
Objective-C
@property (nonatomic) UIEdgeInsets actionButtonInsets;
-
更多动作按钮间距,默认为(0, 24, 0, 0)
Declaration
Objective-C
@property (nonatomic) UIEdgeInsets moreActionButtonInsets;
-
如果不想要内容整体垂直居中,则可通过调整此属性来进行垂直偏移。默认为-30,即内容比中间略微偏上
Declaration
Objective-C
@property (nonatomic) CGFloat verticalOffset;
-
自定义垂直偏移句柄,参数依次为总高度,内容高度,图片高度
Declaration
Objective-C
@property (nonatomic, copy, nullable) CGFloat (^) (CGFloat, CGFloat, CGFloat) verticalOffsetBlock;
-
textLabel字体,默认为15pt系统字体
Declaration
Objective-C
@property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIFont *textLabelFont;
-
detailTextLabel字体,默认为14pt系统字体
Declaration
Objective-C
@property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIFont *detailTextLabelFont;
-
actionButton标题字体,默认为15pt系统字体
Declaration
Objective-C
@property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIFont *actionButtonFont;
-
moreActionButton标题字体,默认为15pt系统字体
Declaration
Objective-C
@property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIFont *moreActionButtonFont;
-
loadingView颜色,默认灰色
Declaration
Objective-C
@property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIColor *loadingViewColor;
-
textLabel文本颜色,默认为(93, 100, 110)
Declaration
Objective-C
@property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIColor *textLabelTextColor;
-
detailTextLabel文本颜色,默认为(133, 140, 150)
Declaration
Objective-C
@property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIColor *detailTextLabelTextColor;
-
actionButton标题颜色,默认为 ButtonTintColor
Declaration
Objective-C
@property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIColor *actionButtonTitleColor;
-
moreActionButton标题颜色,默认为 ButtonTintColor
Declaration
Objective-C
@property (nonatomic, strong) UI_APPEARANCE_SELECTOR UIColor *moreActionButtonTitleColor;
-
显示或隐藏loading图标
Declaration
Objective-C
- (void)setLoadingViewHidden:(BOOL)hidden;
-
设置要显示的图片
Declaration
Objective-C
- (void)setImage:(nullable UIImage *)image;
Parameters
image
要显示的图片,为nil则不显示
-
设置提示语
Declaration
Objective-C
- (void)setTextLabelText:(nullable NSString *)text;
Parameters
text
提示语文本,若为nil则隐藏textLabel
-
设置详细提示语的文本
Declaration
Objective-C
- (void)setDetailTextLabelText:(nullable NSString *)text;
Parameters
text
详细提示语文本,若为nil则隐藏detailTextLabel
-
设置操作按钮的文本
Declaration
Objective-C
- (void)setActionButtonTitle:(nullable NSString *)title;
Parameters
title
操作按钮的文本,若为nil则隐藏actionButton
-
设置更多操作按钮的文本
Declaration
Objective-C
- (void)setMoreActionButtonTitle:(nullable NSString *)title;
Parameters
title
操作按钮的文本,若为nil则隐藏moreActionButton
-
如果要继承QMUIEmptyView并添加新的子 view,则必须:
- 像其它自带 view 一样添加到 contentView 上
- 重写sizeThatContentViewFits
Declaration
Objective-C
@property (nonatomic, strong, readonly) UIView *_Nonnull contentView;
-
返回一个恰好容纳所有子 view 的大小
Declaration
Objective-C
- (CGSize)sizeThatContentViewFits;