UIView+LZEmptyView.m 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #import "UIView+LZEmptyView.h"
  2. @implementation UIView (LZEmptyView)
  3. - (void)lz_showEmptyViewWithImage:(UIImage *)image content:(NSString *)content{
  4. self.ly_emptyView = [LZEmptyView emptyViewWithImage:image titleStr:nil detailStr:content];
  5. [self ly_showEmptyView];
  6. }
  7. - (void)lz_showEmptyViewWithImage:(UIImage *)image content:(NSString *)content btnTitle:(nonnull NSString *)btnTitle btnColor:(nonnull UIColor *)btnColor block:(nonnull void (^)(void))block{
  8. self.ly_emptyView = [LZEmptyView emptyActionViewWithImage:image titleStr:nil detailStr:content btnTitleStr:btnTitle btnClickBlock:block];
  9. self.ly_emptyView.actionBtnFont = LCFont14;
  10. self.ly_emptyView.actionBtnTitleColor = btnColor;
  11. [self ly_showEmptyView];
  12. }
  13. - (void)lz_showEmptyViewWithUrl:(NSURL *)url content:(NSString *)content{
  14. [[SDWebImageDownloader sharedDownloader] downloadImageWithURL:url options:SDWebImageDownloaderUseNSURLCache progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {} completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) {
  15. self.ly_emptyView = [LZEmptyView emptyViewWithImage:image titleStr:nil detailStr:content];
  16. [self ly_showEmptyView];
  17. }];
  18. }
  19. - (void)lz_showEmptyViewWithImageSizeWUWU:(UIImage *)image content:(NSString *)content{
  20. self.ly_emptyView = [LZEmptyView emptyViewWithImage:image titleStr:nil detailStr:content];
  21. self.ly_emptyView.imageSize = CGSizeMake(55, 55);
  22. [self ly_showEmptyView];
  23. }
  24. - (void)lz_showEmptyViewWithImage:(UIImage *)image title:(NSString *)title content:(NSString *)content btnTitle:(NSString *)btnTitle styleBlock:(void (^)(LYEmptyView *emptyView))styleBlock block:(nonnull void (^)(void))block{
  25. self.ly_emptyView = [LZEmptyView emptyActionViewWithImage:image titleStr:title detailStr:content btnTitleStr:btnTitle btnClickBlock:block];
  26. if (styleBlock != nil) {
  27. styleBlock(self.ly_emptyView);
  28. }
  29. [self ly_showEmptyView];
  30. }
  31. //- (void)lz_showAfreshLoadViewWithMsg:(NSString *)msg afreshLoadAction:(nonnull void (^)(void))block{
  32. // self.ly_emptyView = [LZEmptyView emptyActionViewWithImage:[UIImage imageNamed:@"base_no_network"] titleStr:msg detailStr:nil btnTitleStr:@"点击重新加载" btnClickBlock:block];
  33. // [self ly_showEmptyView];
  34. //}
  35. - (void)lz_hideEmptyView{
  36. [self ly_hideEmptyView];
  37. }
  38. @end