95 lines
2.7 KiB
Objective-C
95 lines
2.7 KiB
Objective-C
//
|
|
// XPSendNobleGiftTipView.m
|
|
// xplan-ios
|
|
//
|
|
// Created by GreenLand on 2022/1/18.
|
|
//
|
|
|
|
#import "XPSendNobleGiftTipView.h"
|
|
///Third
|
|
#import <Masonry/Masonry.h>
|
|
#import "ThemeColor.h"
|
|
#import "UIImage+Utils.h"
|
|
#import "TTPopup.h"
|
|
|
|
@interface XPSendNobleGiftTipView ()
|
|
|
|
@property (nonatomic,strong) UILabel *titleLabel;
|
|
|
|
@property (nonatomic,strong) UIButton *doneButton;
|
|
|
|
@end
|
|
|
|
@implementation XPSendNobleGiftTipView
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
self = [super initWithFrame:frame];
|
|
if (self) {
|
|
[self initSubViews];
|
|
[self initSubViewConstraints];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
#pragma mark - Private Method
|
|
- (void)initSubViews {
|
|
self.backgroundColor = [ThemeColor appCellBackgroundColor];
|
|
self.layer.cornerRadius = 12;
|
|
self.layer.masksToBounds = YES;
|
|
[self addSubview:self.titleLabel];
|
|
[self addSubview:self.doneButton];
|
|
}
|
|
|
|
- (void)initSubViewConstraints {
|
|
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerX.mas_equalTo(self);
|
|
make.top.mas_equalTo(20);
|
|
make.left.mas_equalTo(20);
|
|
}];
|
|
|
|
[self.doneButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(180);
|
|
make.height.mas_equalTo(44);
|
|
make.centerX.mas_equalTo(self);
|
|
make.bottom.mas_equalTo(-20);
|
|
}];
|
|
}
|
|
|
|
- (void)setGiftName:(NSString *)giftName {
|
|
_giftName = giftName;
|
|
}
|
|
- (void)setNobleName:(NSString *)nobleName {
|
|
_nobleName = nobleName;
|
|
self.titleLabel.text = [NSString stringWithFormat:@"尚未达到赠送%@所需要的贵族等级哦\n所需贵族等级:%@", self.giftName, nobleName];
|
|
}
|
|
|
|
#pragma mark - event
|
|
- (void)onDoneButtonClick:(UIButton *)sender {
|
|
[TTPopup dismiss];
|
|
}
|
|
|
|
- (UILabel *)titleLabel {
|
|
if (!_titleLabel) {
|
|
_titleLabel = [[UILabel alloc] init];
|
|
_titleLabel.numberOfLines = 0;
|
|
_titleLabel.textColor = [ThemeColor alertMessageColor];
|
|
_titleLabel.font = [UIFont systemFontOfSize:14];
|
|
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
|
}
|
|
return _titleLabel;
|
|
}
|
|
|
|
- (UIButton *)doneButton {
|
|
if (!_doneButton) {
|
|
_doneButton = [[UIButton alloc] init];
|
|
[_doneButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
|
_doneButton.layer.cornerRadius = 22;
|
|
_doneButton.layer.masksToBounds = YES;
|
|
[_doneButton setTitle:@"我知道了" forState:UIControlStateNormal];
|
|
[_doneButton addTarget:self action:@selector(onDoneButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
}
|
|
return _doneButton;
|
|
}
|
|
|
|
@end
|