Няма описание

FLEmptyFooter.m 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // FLEmptyFooter.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 15/6/30.
  6. // Copyright (c) 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "FLEmptyFooter.h"
  9. @interface FLEmptyFooter ()
  10. @property (nonatomic, strong) UIView *bgView;
  11. @property (nonatomic, strong) UIImageView *imageView;
  12. @end
  13. @implementation FLEmptyFooter
  14. /*
  15. // Only override drawRect: if you perform custom drawing.
  16. // An empty implementation adversely affects performance during animation.
  17. - (void)drawRect:(CGRect)rect {
  18. // Drawing code
  19. }
  20. */
  21. - (instancetype)initWithFrame:(CGRect)frame {
  22. self = [super initWithFrame:frame];
  23. if (self) {
  24. self.backgroundColor = [UIColor clearColor];
  25. [self addAllSubviews];
  26. }
  27. return self;
  28. }
  29. - (void)addAllSubviews {
  30. WeakSelf(weakSelf);
  31. [self addSubview:self.bgView];
  32. [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.left.right.bottom.equalTo(weakSelf).with.offset(0);
  34. make.height.mas_equalTo(44);
  35. }];
  36. [self.bgView addSubview:self.textLabel];
  37. [self.textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.centerX.equalTo(weakSelf.bgView).with.offset(18);
  39. make.top.bottom.equalTo(weakSelf.bgView).with.offset(0);
  40. make.width.mas_greaterThanOrEqualTo(20);
  41. }];
  42. [self.bgView addSubview:self.imageView];
  43. [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
  44. make.centerY.equalTo(weakSelf.bgView).with.offset(-2);
  45. make.right.equalTo(weakSelf.textLabel.mas_left).with.offset(-8);
  46. make.size.mas_equalTo(CGSizeMake(25, 22));
  47. }];
  48. }
  49. - (UIView*)bgView {
  50. if (!_bgView) {
  51. _bgView = [[UIView alloc] init];
  52. _bgView.backgroundColor = UIColorFromRGB(0xdcbe9c);
  53. }
  54. return _bgView;
  55. }
  56. - (UIImageView*)imageView {
  57. if (!_imageView) {
  58. _imageView = [[UIImageView alloc] init];
  59. _imageView.image = [UIImage imageNamed:@"EmptyFooterIcon"];
  60. }
  61. return _imageView;
  62. }
  63. - (UILabel *)textLabel {
  64. if (!_textLabel) {
  65. _textLabel = [[UILabel alloc] init];
  66. _textLabel.textColor = UIColorFromRGB(0xffffff);
  67. _textLabel.textAlignment = NSTextAlignmentCenter;
  68. _textLabel.font = [UIFont systemFontOfSize:15];
  69. }
  70. return _textLabel;
  71. }
  72. + (CGFloat)height {
  73. return (44+15);
  74. }
  75. @end