Skip to content

UIView显示网络失败,没有数据,其他错误状态,甚至加载中...

License

Notifications You must be signed in to change notification settings

storm52/BTViewState

Repository files navigation

BTViewState

CI Status Version License Platform

Example

image To run the example project, clone the repo, and run pod install from the Example directory first.

使用

设置默认状态图片与提示


[BTViewStateProperty setImageNoData:[UIImage imageNamed:@"Common_problem_none records"] error:[UIImage imageNamed:@"Common_problem_no data"] network:[UIImage imageNamed:@"Common_problem_network"]];
[BTViewStateProperty setTitleNoData:@"暂无记录" error:@"失败" network:@"网络错误"];

指定视图状态

self.view.viewState = BTViewStateLoading;//加载中
self.view.viewState = BTViewStateDefault;//去除状态图,显示正常界面与数据等

tableView.viewState = BTViewStateLoading;

button.viewState = BTViewStateLoading;

更多视图属性设置


tableView.stateProperties.loadingAreaInsets = UIEdgeInsetsMake(152, 0, 0, 0);
tableView.stateProperties.contentVerticalOffset = -75;
tableView.stateProperties.noDataActionBlock = ^{
    [weakSelf reloadData];
};
view.stateProperties.labelOffset = -20;

[tableView.stateProperties setImage:UIImage.new forLoadState:BTViewStateNoData];

更多等......你探索

Installation

BTViewState is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'BTViewState'

Author

[email protected]

License

BTViewState is available under the MIT license. See the LICENSE file for more info.

About

UIView显示网络失败,没有数据,其他错误状态,甚至加载中...

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published