贵族送礼、发表情未达到等级时弹框提示

This commit is contained in:
chenguilong
2022-03-15 16:29:16 +08:00
parent 687f64355b
commit c2ba6437d6
5 changed files with 16 additions and 132 deletions

View File

@@ -27,7 +27,6 @@
#import "XPGiftUsersView.h"
#import "XPGiftInfoView.h"
#import "XPGiftBarView.h"
#import "XPSendNobleGiftTipView.h"
///P
#import "XPGiftProtocol.h"
///VC
@@ -354,10 +353,14 @@
} else if (code == 8535) {//
[TTPopup dismiss];
GiftInfoModel * giftInfo = self.giftInfoView.lastSelectGift;
XPSendNobleGiftTipView *view = [[XPSendNobleGiftTipView alloc] initWithFrame:CGRectMake(0, 0, 330, 150)];
view.giftName = giftInfo.giftName;
view.nobleName = giftInfo.giftVipInfo.vipName;
[TTPopup popupView:view style:TTPopupStyleAlert];
TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.actionStyle = TTAlertActionConfirmStyle;
config.message = [NSString stringWithFormat:@"尚未达到赠送%@所需要的贵族等级哦\n所需贵族等级%@", giftInfo.giftName, giftInfo.giftVipInfo.vipName];
[TTPopup alertWithConfig:config confirmHandler:^{
} cancelHandler:^{
}];
} else {
[XCHUDTool showErrorWithMessage:msg];
}

View File

@@ -1,21 +0,0 @@
//
// XPSendNobleGiftTipView.h
// xplan-ios
//
// Created by GreenLand on 2022/1/18.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPSendNobleGiftTipView : UIView
///礼物名称
@property (nonatomic, copy) NSString *giftName;
///贵族名称
@property (nonatomic, copy) NSString *nobleName;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,94 +0,0 @@
//
// 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