Quick show placholder or empty UI in any view, easy to support refresh UI when service Api responsed.
pod search WyhShowEmpty
[self wyh_showEmptyMsg:@"No data" dataCount:self.dataSource];
WyhEmptyStyle *style = [[WyhEmptyStyle alloc]init];
style.tipText = @"Service down!";
style.tipTextColor = [UIColor brownColor];
style.btnTipText = @"Disappear";
style.imageConfig.type = GifImgLocalUrl;
style.refreshStyle = RefreshClickOnBtnStyle;
style.btnWidth = 100;
style.btnHeight = 100;
style.btnLayerCornerRadius = 50;
style.btnLayerBorderColor = [UIColor redColor];
[self wyh_showWithStyle:style];
3. Show empty UI in every service request, and refresh UI in every response . So it will show empty view if resp data was nil.
-(void)loadNetWork{
[[AFHTTPSessionManager manager] POST:url parameters:body progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
if ([responseObject[@"code"] isEqualToNumber:@0]) {
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
// suc resp:
[self wyh_showEmptyMsg:@"No new data." dataCount:self.dataSource];
});
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
// failure resp:
[self wyh_showEmptyMsg:@"Service disabled!" dataCount:0 isHasBtn:YES Handler:^{
[self loadNetWork];
}];
}];
}