dkahgld

NoDataView.m 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // NoDataView.m
  3. // ZBProject
  4. //
  5. // Created by 学丽 on 2019/4/24.
  6. // Copyright © 2019 ZB. All rights reserved.
  7. //
  8. #import "NoDataView.h"
  9. @implementation NoDataView
  10. -(instancetype)initWithFrame:(CGRect)frame
  11. {
  12. self=[super initWithFrame:frame];
  13. if (self) {
  14. [self setUIs];
  15. }
  16. return self;
  17. }
  18. -(void)setIsShowNoDataView:(BOOL)isShowNoDataView
  19. {
  20. _isShowNoDataView = isShowNoDataView;
  21. }
  22. -(void)setFrame:(CGRect)frame AndImg:(NSString *)img title:(NSString *)title isShow:(BOOL)isshow
  23. {
  24. self.frame=frame;
  25. self.imgView.image=[UIImage imageNamed:img];
  26. self.tipeLabel.text=title;
  27. if (!isshow) {
  28. self.hidden=YES;
  29. }else{
  30. self.hidden=NO;
  31. }
  32. }
  33. -(void)setUIs
  34. {
  35. [self addSubview:self.imgView];
  36. [self addSubview:self.tipeLabel];
  37. [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.centerX.mas_equalTo(self.mas_centerX);
  39. make.centerY.mas_equalTo(self.mas_centerY);
  40. make.width.height.mas_equalTo(100);
  41. }];
  42. [self.tipeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  43. make.left.right.mas_equalTo(0);
  44. make.height.mas_equalTo(20);
  45. make.top.mas_equalTo(self.imgView.mas_bottom);
  46. }];
  47. }
  48. -(UIImageView *)imgView
  49. {
  50. if (!_imgView) {
  51. _imgView =[[UIImageView alloc]init];
  52. _imgView.image=[UIImage imageNamed:@"no_order"];
  53. }
  54. return _imgView;
  55. }
  56. -(UILabel *)tipeLabel
  57. {
  58. if (!_tipeLabel) {
  59. _tipeLabel =[[UILabel alloc]init];
  60. _tipeLabel.text=@"还没有记录";
  61. _tipeLabel.font=[UIFont systemFontOfSize:14];
  62. _tipeLabel.textColor=[UIColor YHColorWithHex:0x333333];
  63. _tipeLabel.textAlignment=NSTextAlignmentCenter;
  64. }
  65. return _tipeLabel;
  66. }
  67. @end