12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- //
- // FLEmptyFooter.m
- // FirstLink
- //
- // Created by ascii on 15/6/30.
- // Copyright (c) 2015年 FirstLink. All rights reserved.
- //
- #import "FLEmptyFooter.h"
- @interface FLEmptyFooter ()
- @property (nonatomic, strong) UIView *bgView;
- @property (nonatomic, strong) UIImageView *imageView;
- @end
- @implementation FLEmptyFooter
- /*
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- - (void)drawRect:(CGRect)rect {
- // Drawing code
- }
- */
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.backgroundColor = [UIColor clearColor];
- [self addAllSubviews];
- }
- return self;
- }
- - (void)addAllSubviews {
- WeakSelf(weakSelf);
- [self addSubview:self.bgView];
- [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.bottom.equalTo(weakSelf).with.offset(0);
- make.height.mas_equalTo(44);
- }];
-
- [self.bgView addSubview:self.textLabel];
- [self.textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(weakSelf.bgView).with.offset(18);
- make.top.bottom.equalTo(weakSelf.bgView).with.offset(0);
- make.width.mas_greaterThanOrEqualTo(20);
- }];
-
- [self.bgView addSubview:self.imageView];
- [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(weakSelf.bgView).with.offset(-2);
- make.right.equalTo(weakSelf.textLabel.mas_left).with.offset(-8);
- make.size.mas_equalTo(CGSizeMake(25, 22));
- }];
- }
- - (UIView*)bgView {
- if (!_bgView) {
- _bgView = [[UIView alloc] init];
- _bgView.backgroundColor = UIColorFromRGB(0xdcbe9c);
- }
- return _bgView;
- }
- - (UIImageView*)imageView {
- if (!_imageView) {
- _imageView = [[UIImageView alloc] init];
- _imageView.image = [UIImage imageNamed:@"EmptyFooterIcon"];
- }
- return _imageView;
- }
- - (UILabel *)textLabel {
- if (!_textLabel) {
- _textLabel = [[UILabel alloc] init];
- _textLabel.textColor = UIColorFromRGB(0xffffff);
- _textLabel.textAlignment = NSTextAlignmentCenter;
- _textLabel.font = [UIFont systemFontOfSize:15];
- }
- return _textLabel;
- }
- + (CGFloat)height {
- return (44+15);
- }
- @end
|