cdts/xdts-ios 3/TreeHole/CYHResetCode/CYH/QMUIKit/QMUIComponents/QMUIEmptyView.h

94 lines
4.3 KiB
C
Raw Normal View History

2023-07-27 09:20:00 +08:00
/**
* Tencent is pleased to support the open source community by making QMUI_iOS available.
* Copyright (C) 2016-2021 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/MIT
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
//
// QMUIEmptyView.h
// qmui
//
// Created by QMUI Team on 2016/10/9.
//
#import <UIKit/UIKit.h>
@class QMUIButton;
@protocol QMUIEmptyViewLoadingViewProtocol <NSObject>
@optional
- (void)startAnimating; // 当调用 setLoadingViewHidden:NO 时,系统将自动调用此处的 startAnimating
@end
/**
* loadingQMUICommonViewController emptyView
*/
@interface QMUIEmptyView : UIView
// 布局顺序从上到下依次为imageView, loadingView, textLabel, detailTextLabel, actionButton
@property(nonatomic, strong) UIView<QMUIEmptyViewLoadingViewProtocol> *loadingView; // 此控件通过设置 loadingView.hidden 来控制 loadinView 的显示和隐藏因此请确保你的loadingView 没有类似于 hidesWhenStopped = YES 之类会使 view.hidden 失效的属性
@property(nonatomic, strong, readonly) UIImageView *imageView;
@property(nonatomic, strong, readonly) UILabel *textLabel;
@property(nonatomic, strong, readonly) UILabel *detailTextLabel;
@property(nonatomic, strong, readonly) QMUIButton *actionButton;
// 可通过调整这些insets来控制间距
@property(nonatomic, assign) UIEdgeInsets imageViewInsets UI_APPEARANCE_SELECTOR; // 默认为(0, 0, 36, 0)
@property(nonatomic, assign) UIEdgeInsets loadingViewInsets UI_APPEARANCE_SELECTOR; // 默认为(0, 0, 36, 0)
@property(nonatomic, assign) UIEdgeInsets textLabelInsets UI_APPEARANCE_SELECTOR; // 默认为(0, 0, 10, 0)
@property(nonatomic, assign) UIEdgeInsets detailTextLabelInsets UI_APPEARANCE_SELECTOR; // 默认为(0, 0, 10, 0)
@property(nonatomic, assign) UIEdgeInsets actionButtonInsets UI_APPEARANCE_SELECTOR; // 默认为(0, 0, 0, 0)
@property(nonatomic, assign) CGFloat verticalOffset UI_APPEARANCE_SELECTOR; // 如果不想要内容整体垂直居中,则可通过调整此属性来进行垂直偏移。默认为-30即内容比中间略微偏上
// 字体
@property(nonatomic, strong) UIFont *textLabelFont UI_APPEARANCE_SELECTOR; // 默认为15pt系统字体
@property(nonatomic, strong) UIFont *detailTextLabelFont UI_APPEARANCE_SELECTOR; // 默认为14pt系统字体
@property(nonatomic, strong) UIFont *actionButtonFont UI_APPEARANCE_SELECTOR; // 默认为15pt系统字体
// 颜色
@property(nonatomic, strong) UIColor *textLabelTextColor UI_APPEARANCE_SELECTOR; // 默认为(93, 100, 110)
@property(nonatomic, strong) UIColor *detailTextLabelTextColor UI_APPEARANCE_SELECTOR; // 默认为(133, 140, 150)
@property(nonatomic, strong) UIColor *actionButtonTitleColor UI_APPEARANCE_SELECTOR; // 默认为 ButtonTintColor
// 显示或隐藏loading图标
- (void)setLoadingViewHidden:(BOOL)hidden;
/**
*
* @param image nil则不显示
*/
- (void)setImage:(UIImage *)image;
/**
*
* @param text nil则隐藏textLabel
*/
- (void)setTextLabelText:(NSString *)text;
/**
*
* @param text nil则隐藏detailTextLabel
*/
- (void)setDetailTextLabelText:(NSString *)text;
/**
*
* @param title nil则隐藏actionButton
*/
- (void)setActionButtonTitle:(NSString *)title;
/**
* QMUIEmptyView并添加新的子 view
* 1. view contentView
* 2. sizeThatContentViewFits
*/
@property(nonatomic, strong, readonly) UIView *contentView;
- (CGSize)sizeThatContentViewFits; // 返回一个恰好容纳所有子 view 的大小
@end