Files
yinmeng-ios/xplan-ios/Main/ModuleKit/SendGiftView/View/Cell/XPGiftEmptyCollectionViewCell.m
2022-06-14 17:31:44 +08:00

78 lines
1.9 KiB
Objective-C

//
// XPGiftEmptyCollectionViewCell.m
// xplan-ios
//
// Created by 冯硕 on 2021/11/15.
//
#import "XPGiftEmptyCollectionViewCell.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor+SendGift.h"
@interface XPGiftEmptyCollectionViewCell ()
@property (nonatomic,strong) UIImageView *logoImageView;
@property (nonatomic,strong) UILabel *emptyPackTip;
@end
@implementation XPGiftEmptyCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self.contentView addSubview:self.logoImageView];
[self.contentView addSubview:self.emptyPackTip];
}
- (void)initSubViewConstraints {
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(40, 40));
make.bottom.mas_equalTo(self.mas_centerY).offset(-3);
make.centerX.mas_equalTo(self);
}];
[self.emptyPackTip mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.mas_centerY).offset(3);
make.centerX.mas_equalTo(self);
}];
}
#pragma mark - Getters And Setters
- (void)setEmptyTitle:(NSString *)emptyTitle {
_emptyTitle = emptyTitle;
if (_emptyTitle.length > 0) {
self.emptyPackTip.text = _emptyTitle;
}
}
- (UILabel *)emptyPackTip {
if (!_emptyPackTip) {
_emptyPackTip = [[UILabel alloc] init];
_emptyPackTip.text = @"背包暂无内容~";;
_emptyPackTip.textColor = [ThemeColor secondTextColor];
_emptyPackTip.font = [UIFont systemFontOfSize:12];
_emptyPackTip.textAlignment = NSTextAlignmentCenter;
}
return _emptyPackTip;
}
- (UIImageView *)logoImageView {
if (!_logoImageView) {
_logoImageView = [[UIImageView alloc] init];
_logoImageView.userInteractionEnabled = YES;
_logoImageView.image = [UIImage imageNamed:@"gift_info_empty_bg"];
}
return _logoImageView;
}
@end