2022-06-02 18:53:45 +08:00
|
|
|
|
//
|
|
|
|
|
// XPHomeNewUserGreetView.m
|
|
|
|
|
// xplan-ios
|
|
|
|
|
//
|
|
|
|
|
// Created by 冯硕 on 2022/6/2.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#import "XPNewUserGreetRoomAlertView.h"
|
|
|
|
|
///Third
|
|
|
|
|
#import <Masonry/Masonry.h>
|
|
|
|
|
///Tool
|
|
|
|
|
#import "ThemeColor.h"
|
|
|
|
|
#import "NetImageView.h"
|
|
|
|
|
#import "XPMacro.h"
|
|
|
|
|
#import "TTPopup.h"
|
2022-11-22 14:27:52 +08:00
|
|
|
|
#import "UIImage+Utils.h"
|
|
|
|
|
#import <AFNetworking.h>
|
|
|
|
|
#import "XPSkillCardPlayerManager.h"
|
2022-06-02 18:53:45 +08:00
|
|
|
|
///Model
|
|
|
|
|
#import "NewUserGreetModel.h"
|
|
|
|
|
///View
|
|
|
|
|
#import "XPRoomViewController.h"
|
|
|
|
|
|
|
|
|
|
@interface XPNewUserGreetRoomAlertView ()
|
2022-11-22 14:27:52 +08:00
|
|
|
|
|
|
|
|
|
@property (nonatomic, strong) UIImageView *logoImageView;
|
|
|
|
|
@property (nonatomic, strong) UIView *avatarAlphaView;
|
2022-06-02 18:53:45 +08:00
|
|
|
|
///头像覆盖
|
|
|
|
|
@property (nonatomic,strong) UIImageView *avatarCoverView;
|
|
|
|
|
///头像
|
|
|
|
|
@property (nonatomic,strong) NetImageView *avatarImageView;
|
2022-11-22 14:27:52 +08:00
|
|
|
|
///渐变背景
|
|
|
|
|
@property (nonatomic, strong) UIImageView *effectView;
|
2022-06-02 18:53:45 +08:00
|
|
|
|
///昵称
|
|
|
|
|
@property (nonatomic,strong) UIButton *nickButton;
|
2022-11-22 14:27:52 +08:00
|
|
|
|
///性别
|
|
|
|
|
@property (nonatomic, strong) UIImageView *genderImageView;
|
2022-06-02 18:53:45 +08:00
|
|
|
|
///打招呼文案
|
|
|
|
|
@property (nonatomic,strong) UILabel *greetLabel;
|
|
|
|
|
///开始浪漫之旅
|
|
|
|
|
@property (nonatomic,strong) UIButton *startButton;
|
2022-11-22 14:27:52 +08:00
|
|
|
|
///声音秀背景
|
|
|
|
|
@property (nonatomic, strong) UIImageView *voiceShowBgImage;
|
|
|
|
|
///播放按钮
|
|
|
|
|
@property (nonatomic, strong) UIButton *playButton;
|
|
|
|
|
///声音秀波纹
|
|
|
|
|
@property (nonatomic, strong) UIImageView *voiceImage;
|
|
|
|
|
///播放中
|
|
|
|
|
@property (nonatomic,assign) BOOL isPlaying;
|
|
|
|
|
|
2022-06-02 18:53:45 +08:00
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@implementation XPNewUserGreetRoomAlertView
|
|
|
|
|
|
2022-11-22 14:27:52 +08:00
|
|
|
|
- (void)dealloc {
|
|
|
|
|
[[XPSkillCardPlayerManager shareInstance] stopMusic];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)removeFromSuperview {
|
|
|
|
|
[super removeFromSuperview];
|
|
|
|
|
[[XPSkillCardPlayerManager shareInstance] stopMusic];
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-02 18:53:45 +08:00
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
|
|
|
self = [super initWithFrame:frame];
|
|
|
|
|
if (self) {
|
|
|
|
|
[self initSubViews];
|
|
|
|
|
[self initSubViewConstraints];
|
|
|
|
|
}
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma mark - Private Method
|
|
|
|
|
- (void)initSubViews {
|
2022-11-22 14:27:52 +08:00
|
|
|
|
[self addSubview:self.logoImageView];
|
|
|
|
|
[self addSubview:self.avatarAlphaView];
|
|
|
|
|
[self addSubview:self.avatarCoverView];
|
|
|
|
|
[self addSubview:self.avatarImageView];
|
|
|
|
|
[self.avatarImageView addSubview:self.effectView];
|
|
|
|
|
[self.avatarImageView addSubview:self.nickButton];
|
|
|
|
|
[self.avatarImageView addSubview:self.genderImageView];
|
|
|
|
|
[self.avatarImageView addSubview:self.greetLabel];
|
2022-06-02 18:53:45 +08:00
|
|
|
|
[self addSubview:self.startButton];
|
2022-11-22 14:27:52 +08:00
|
|
|
|
|
|
|
|
|
[self addSubview:self.voiceShowBgImage];
|
|
|
|
|
[self.voiceShowBgImage addSubview:self.playButton];
|
|
|
|
|
[self.voiceShowBgImage addSubview:self.voiceImage];
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)initSubViewConstraints {
|
|
|
|
|
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
2022-11-22 14:27:52 +08:00
|
|
|
|
make.size.mas_equalTo(CGSizeMake(250, 74+6+290+28+44));
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}];
|
2022-11-22 14:27:52 +08:00
|
|
|
|
[self.logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.top.mas_equalTo(0);
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(211, 74));
|
|
|
|
|
make.centerX.mas_equalTo(self);
|
|
|
|
|
}];
|
|
|
|
|
[self.avatarAlphaView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(250, 290));
|
|
|
|
|
make.centerX.mas_equalTo(self);
|
|
|
|
|
make.top.mas_equalTo(self.logoImageView.mas_bottom).offset(6);
|
|
|
|
|
}];
|
|
|
|
|
[self.avatarCoverView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(240, 280));
|
|
|
|
|
make.centerX.centerY.mas_equalTo(self.avatarAlphaView);
|
|
|
|
|
}];
|
2022-06-02 18:53:45 +08:00
|
|
|
|
|
|
|
|
|
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
2022-11-22 14:27:52 +08:00
|
|
|
|
make.size.mas_equalTo(CGSizeMake(230, 270));
|
|
|
|
|
make.centerX.centerY.mas_equalTo(self.avatarAlphaView);
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}];
|
2022-11-22 14:27:52 +08:00
|
|
|
|
[self.effectView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.bottom.left.right.mas_equalTo(self.avatarImageView);
|
|
|
|
|
make.height.mas_equalTo(115);
|
|
|
|
|
}];
|
2022-06-02 18:53:45 +08:00
|
|
|
|
[self.nickButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
2022-11-22 14:27:52 +08:00
|
|
|
|
make.left.mas_equalTo(self.avatarImageView).mas_offset(6);
|
|
|
|
|
make.bottom.mas_equalTo(self.greetLabel.mas_top).mas_offset(-8);
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}];
|
|
|
|
|
|
2022-11-22 14:27:52 +08:00
|
|
|
|
[self.genderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(14, 14));
|
|
|
|
|
make.centerY.mas_equalTo(self.nickButton);
|
|
|
|
|
make.left.mas_equalTo(self.nickButton.mas_right).mas_offset(4);
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
[self.greetLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
2022-11-22 14:27:52 +08:00
|
|
|
|
make.left.right.mas_equalTo(self.avatarImageView).inset(6);
|
|
|
|
|
make.bottom.mas_equalTo(self.avatarImageView).mas_offset(-8);
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
[self.startButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
2022-11-22 14:27:52 +08:00
|
|
|
|
make.size.mas_equalTo(CGSizeMake(200, 44));
|
2022-06-02 18:53:45 +08:00
|
|
|
|
make.centerX.mas_equalTo(self);
|
2022-11-22 14:27:52 +08:00
|
|
|
|
make.top.mas_equalTo(self.avatarAlphaView.mas_bottom).offset(28);
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}];
|
2022-11-22 14:27:52 +08:00
|
|
|
|
|
|
|
|
|
[self.voiceShowBgImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.right.mas_equalTo(self.avatarAlphaView).mas_offset(-14);
|
|
|
|
|
make.top.mas_equalTo(self.avatarAlphaView).mas_offset(17);
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(44, 21));
|
|
|
|
|
}];
|
|
|
|
|
[self.playButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.left.mas_equalTo(self.voiceShowBgImage).mas_offset(3);
|
|
|
|
|
make.centerY.mas_equalTo(self.voiceShowBgImage);
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(14, 14));
|
|
|
|
|
}];
|
|
|
|
|
[self.voiceImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.right.mas_equalTo(self.voiceShowBgImage).mas_offset(-5);
|
|
|
|
|
make.centerY.mas_equalTo(self.voiceShowBgImage);
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(20, 10));
|
|
|
|
|
}];
|
|
|
|
|
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}
|
|
|
|
|
#pragma mark - Event Response
|
|
|
|
|
- (void)startButtonAction:(UIButton *)sender {
|
|
|
|
|
[TTPopup dismiss];
|
|
|
|
|
if (self.greetInfo.roomUid.length > 0) {
|
2022-06-07 16:16:27 +08:00
|
|
|
|
[XPRoomViewController openRoom:self.greetInfo.roomUid fromNick:self.greetInfo.sayHelloUserNickname fromType:UserEnterRoomFromType_New_User_Greet fromUid:self.greetInfo.roomUid viewController:self.currentVC];
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-22 14:27:52 +08:00
|
|
|
|
- (void)playButtonAction:(UIButton *)sender {
|
|
|
|
|
sender.selected = !sender.selected;
|
|
|
|
|
if (!self.isPlaying) {
|
|
|
|
|
// NSString *fileName = [[self.greetInfo.voiceCard.name componentsSeparatedByString:@"/"] lastObject];
|
|
|
|
|
// fileName = [NSString stringWithFormat:@"%zd_%@", self.cardInfo.uid, fileName];
|
|
|
|
|
// NSString * url = [self.greetInfo.voiceCard.propVals safeObjectAtIndex1:0];
|
|
|
|
|
// NSString *filePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"mineSkillCardVoice"];
|
|
|
|
|
// NSString *fullPath = [filePath stringByAppendingPathComponent:fileName];
|
|
|
|
|
// if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]) {
|
|
|
|
|
// self.isPlaying = YES;
|
|
|
|
|
// sender.selected = YES;
|
|
|
|
|
//
|
|
|
|
|
// [[XPSkillCardPlayerManager shareInstance] playerVoiceWithPath:fullPath completionBlock:^{
|
|
|
|
|
// self.isPlaying = NO;
|
|
|
|
|
// sender.selected = NO;
|
|
|
|
|
// [[XPSkillCardPlayerManager shareInstance] stopMusic];
|
|
|
|
|
// }];
|
|
|
|
|
// } else {
|
|
|
|
|
// if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
|
|
|
|
|
// NSFileManager *fileMgr = [[NSFileManager alloc] init];
|
|
|
|
|
// [fileMgr createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil];
|
|
|
|
|
// }
|
|
|
|
|
// [self downloadAudioWithFileName:fileName musicUrl:url completion:^(BOOL isSuccess, NSString *editAudioPath) {
|
|
|
|
|
// self.isPlaying = YES;
|
|
|
|
|
// sender.selected = YES;
|
|
|
|
|
// [[XPSkillCardPlayerManager shareInstance] playerVoiceWithPath:fullPath completionBlock:^{
|
|
|
|
|
// self.isPlaying = NO;
|
|
|
|
|
// sender.selected = NO;
|
|
|
|
|
// [[XPSkillCardPlayerManager shareInstance] stopMusic];
|
|
|
|
|
// }];
|
|
|
|
|
// }];
|
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
self.isPlaying = NO;
|
|
|
|
|
sender.selected = NO;
|
|
|
|
|
[[XPSkillCardPlayerManager shareInstance] stopMusic];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)downloadAudioWithFileName:(NSString *)fileName musicUrl:(NSString *)musicUrl completion:(void (^) (BOOL isSuccess, NSString *editAudioPath))completion {
|
|
|
|
|
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
|
|
|
|
|
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:musicUrl]];
|
|
|
|
|
NSURLSessionDownloadTask *download = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) {
|
|
|
|
|
} destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
|
|
|
|
|
NSString *filePath = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"mineSkillCardVoice"] stringByAppendingPathComponent:fileName];
|
|
|
|
|
return [NSURL fileURLWithPath:filePath];
|
|
|
|
|
} completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
|
|
|
|
|
if (!error) {
|
|
|
|
|
completion(YES, filePath.path);
|
|
|
|
|
} else {
|
|
|
|
|
completion(NO, nil);
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
[download resume];
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-02 18:53:45 +08:00
|
|
|
|
#pragma mark - Getters And Setters
|
|
|
|
|
- (void)setGreetInfo:(NewUserGreetModel *)greetInfo {
|
|
|
|
|
_greetInfo = greetInfo;
|
|
|
|
|
if (_greetInfo) {
|
|
|
|
|
self.avatarImageView.imageUrl = _greetInfo.sayHelloUserAvatar;
|
|
|
|
|
NSString * nick = _greetInfo.sayHelloUserNickname;
|
|
|
|
|
if (nick.length > 6) {
|
|
|
|
|
nick = [nick substringToIndex:6];
|
|
|
|
|
}
|
|
|
|
|
[self.nickButton setTitle:nick forState:UIControlStateNormal];
|
2022-09-22 14:08:26 +08:00
|
|
|
|
self.greetLabel.text = _greetInfo.sayHelloMsg.length > 0 ? _greetInfo.sayHelloMsg : @"欢迎来到魔力,Ta已经等待你很久啦,快来一起玩吧~";
|
2022-11-22 14:27:52 +08:00
|
|
|
|
self.genderImageView.image = greetInfo.gender == 1 ? [UIImage imageNamed:@"common_male"] : [UIImage imageNamed:@"common_female"];
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-22 14:27:52 +08:00
|
|
|
|
- (UIImageView *)logoImageView {
|
|
|
|
|
if (!_logoImageView) {
|
|
|
|
|
_logoImageView = [[UIImageView alloc] init];
|
|
|
|
|
_logoImageView.image = [UIImage imageNamed:@"home_new_user_greet_icon"];
|
|
|
|
|
}
|
|
|
|
|
return _logoImageView;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UIView *)avatarAlphaView {
|
|
|
|
|
if (!_avatarAlphaView) {
|
|
|
|
|
_avatarAlphaView = [[UIView alloc] init];
|
|
|
|
|
_avatarAlphaView.backgroundColor = UIColorRGBAlpha(0xffffff, 0.5);
|
|
|
|
|
_avatarAlphaView.layer.masksToBounds = YES;
|
|
|
|
|
_avatarAlphaView.layer.cornerRadius = 24;
|
|
|
|
|
}
|
|
|
|
|
return _avatarAlphaView;
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UIImageView *)avatarCoverView {
|
|
|
|
|
if (!_avatarCoverView) {
|
|
|
|
|
_avatarCoverView = [[UIImageView alloc] init];
|
|
|
|
|
_avatarCoverView.userInteractionEnabled = YES;
|
2022-11-22 14:27:52 +08:00
|
|
|
|
_avatarCoverView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x7BFFD9), UIColorFromRGB(0x3BE4FF)] gradientType:GradientTypeTopToBottom imgSize:CGSizeMake(10, 10)];
|
|
|
|
|
_avatarCoverView.layer.masksToBounds = YES;
|
|
|
|
|
_avatarCoverView.layer.cornerRadius = 20;
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}
|
|
|
|
|
return _avatarCoverView;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NetImageView *)avatarImageView {
|
|
|
|
|
if (!_avatarImageView) {
|
|
|
|
|
NetImageConfig * config = [[NetImageConfig alloc]init];
|
|
|
|
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
|
|
|
|
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
2022-11-22 14:27:52 +08:00
|
|
|
|
_avatarImageView.contentMode = UIViewContentModeScaleAspectFill;
|
2022-06-02 18:53:45 +08:00
|
|
|
|
_avatarImageView.layer.masksToBounds = YES;
|
2022-11-22 14:27:52 +08:00
|
|
|
|
_avatarImageView.layer.cornerRadius = 16;
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}
|
|
|
|
|
return _avatarImageView;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UIButton *)nickButton {
|
|
|
|
|
if (!_nickButton) {
|
|
|
|
|
_nickButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
2022-11-22 14:27:52 +08:00
|
|
|
|
_nickButton.titleLabel.textColor = [UIColor whiteColor];
|
|
|
|
|
_nickButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}
|
|
|
|
|
return _nickButton;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-22 14:27:52 +08:00
|
|
|
|
- (UIImageView *)genderImageView {
|
|
|
|
|
if (!_genderImageView) {
|
|
|
|
|
_genderImageView = [[UIImageView alloc] init];
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}
|
2022-11-22 14:27:52 +08:00
|
|
|
|
return _genderImageView;
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UILabel *)greetLabel {
|
|
|
|
|
if (!_greetLabel) {
|
|
|
|
|
_greetLabel = [[UILabel alloc] init];
|
|
|
|
|
_greetLabel.font = [UIFont systemFontOfSize:12];
|
2022-11-22 14:27:52 +08:00
|
|
|
|
_greetLabel.textColor = UIColorFromRGB(0xFFFFFF);
|
|
|
|
|
_greetLabel.numberOfLines = 2;
|
|
|
|
|
[_greetLabel sizeToFit];
|
2022-06-02 18:53:45 +08:00
|
|
|
|
}
|
|
|
|
|
return _greetLabel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UIButton *)startButton {
|
|
|
|
|
if (!_startButton) {
|
|
|
|
|
_startButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
2022-11-22 14:27:52 +08:00
|
|
|
|
[_startButton setBackgroundImage:[UIImage imageNamed:@"home_new_user_greet_start"] forState:UIControlStateNormal];
|
2022-06-02 18:53:45 +08:00
|
|
|
|
[_startButton addTarget:self action:@selector(startButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
}
|
|
|
|
|
return _startButton;
|
|
|
|
|
}
|
2022-11-22 14:27:52 +08:00
|
|
|
|
|
|
|
|
|
- (UIImageView *)voiceShowBgImage {
|
|
|
|
|
if (!_voiceShowBgImage) {
|
|
|
|
|
_voiceShowBgImage = [[UIImageView alloc] init];
|
|
|
|
|
_voiceShowBgImage.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xF3F4ED), UIColorFromRGB(0xDFF8FC)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(44, 21)];
|
|
|
|
|
_voiceShowBgImage.userInteractionEnabled = YES;
|
|
|
|
|
_voiceShowBgImage.layer.cornerRadius = 10.5f;
|
|
|
|
|
_voiceShowBgImage.layer.masksToBounds = YES;
|
|
|
|
|
}
|
|
|
|
|
return _voiceShowBgImage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UIButton *)playButton {
|
|
|
|
|
if (!_playButton) {
|
|
|
|
|
_playButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
[_playButton setBackgroundImage:[UIImage imageNamed:@"home_new_user_greet_play"] forState:UIControlStateNormal];
|
|
|
|
|
[_playButton addTarget:self action:@selector(playButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
}
|
|
|
|
|
return _playButton;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UIImageView *)voiceImage {
|
|
|
|
|
if (!_voiceImage) {
|
|
|
|
|
_voiceImage = [[UIImageView alloc] init];
|
|
|
|
|
_voiceImage.image = [UIImage imageNamed:@"home_new_user_greet_wave"];
|
|
|
|
|
}
|
|
|
|
|
return _voiceImage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UIImageView *)effectView {
|
|
|
|
|
if (!_effectView) {
|
|
|
|
|
_effectView = [[UIImageView alloc] init];
|
|
|
|
|
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
|
|
|
|
|
gradientLayer.colors = @[(__bridge id)UIColorRGBAlpha(0xffffff, 0).CGColor, (__bridge id)UIColorRGBAlpha(0x000000, 0.75).CGColor];
|
|
|
|
|
gradientLayer.locations = @[@0, @1.0];
|
|
|
|
|
gradientLayer.startPoint = CGPointMake(0, 0);
|
|
|
|
|
gradientLayer.endPoint = CGPointMake(0, 1);
|
|
|
|
|
gradientLayer.frame = CGRectMake(0, 0, 240, 115);
|
|
|
|
|
[_effectView.layer addSublayer:gradientLayer];
|
|
|
|
|
}
|
|
|
|
|
return _effectView;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-02 18:53:45 +08:00
|
|
|
|
@end
|