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];
更多等......你探索
BTViewState is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'BTViewState'
BTViewState is available under the MIT license. See the LICENSE file for more info.