// // YOUPAINIMInputVoiceView.m // XLChat // // Created by 张灿 on 2017/11/3. // Copyright © 2017年 张灿. All rights reserved. // #import "YOUPAINIMInputVoiceView.h" @implementation YOUPAINIMInputVoiceView - (instancetype)initWithFrame:(CGRect)frame{ if (self=[super initWithFrame:frame]) { self.backgroundColor = [UIColor whiteColor]; [self youpaifsetupUI]; } return self; } - (void)youpaifsetupUI{ // self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 35, KScreenWidth, 20)]; self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 35, KScreenWidth, 20)]; self.titleLabel.font = [UIFont systemFontOfSize:15]; self.titleLabel.textColor = LZ475A7DColor; self.titleLabel.textAlignment = NSTextAlignmentCenter; self.titleLabel.text = @"按住 说话"; [self addSubview:self.titleLabel]; // self.timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 10, KScreenWidth, 25)]; self.timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 50, KScreenWidth, 20)]; self.timeLabel.font = [UIFont systemFontOfSize:15]; self.timeLabel.textColor = [UIColor lightGrayColor]; self.timeLabel.textAlignment = NSTextAlignmentCenter; self.timeLabel.text = @""; [self addSubview:self.timeLabel]; self.recordBt = [[UIButton alloc]initWithFrame:CGRectMake((KScreenWidth-224)/2, 80, 224, 92)]; self.recordBt.adjustsImageWhenHighlighted = NO; // self.recordBt.backgroundColor = LCYellowColor; // self.recordBt.layer.borderWidth = 5.0; // self.recordBt.layer.borderColor = DecColorFromRGB(214, 230, 243).CGColor; // self.recordBt.layer.cornerRadius = 70; // self.recordBt.layer.masksToBounds = YES; [self.recordBt setImage:[UIImage imageNamed:@"vqu_images_vqu_images_IM_im_record_Voice"] forState:UIControlStateNormal]; [self.recordBt setContentMode:UIViewContentModeCenter]; [self addSubview:self.recordBt]; } - (void)setRecordTime:(NSTimeInterval)recordTime { NSInteger minutes = (NSInteger)recordTime / 60; NSInteger seconds = (NSInteger)recordTime % 60; self.timeLabel.text = [NSString stringWithFormat:@"%02zd:%02zd", minutes, seconds]; } - (void)setPhase:(NIMAudioRecordPhase)phase { // if(phase == AudioRecordPhaseStart) { // [self setRecordTime:0]; //// _titleLabel.text = @"准备中.."; // }else if(phase == AudioRecordPhaseCancelling) { //// _tipLabel.text = @"松开手指,取消发送"; //// _tipBackgroundView.hidden = NO; // _titleLabel.text = @"松开手指,取消发送"; // }else { //// _tipLabel.text = @"手指上滑,取消发送"; //// _tipBackgroundView.hidden = YES; // _titleLabel.text = @"手指左右移动,取消发送"; // } } @end