YOUPAINIMInputVoiceView.m 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. //
  2. // YOUPAINIMInputVoiceView.m
  3. // XLChat
  4. //
  5. // Created by 张灿 on 2017/11/3.
  6. // Copyright © 2017年 张灿. All rights reserved.
  7. //
  8. #import "YOUPAINIMInputVoiceView.h"
  9. @implementation YOUPAINIMInputVoiceView
  10. - (instancetype)initWithFrame:(CGRect)frame{
  11. if (self=[super initWithFrame:frame]) {
  12. self.backgroundColor = [UIColor whiteColor];
  13. [self youpaifsetupUI];
  14. }
  15. return self;
  16. }
  17. - (void)youpaifsetupUI{
  18. // self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 35, KScreenWidth, 20)];
  19. self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 35, KScreenWidth, 20)];
  20. self.titleLabel.font = [UIFont systemFontOfSize:15];
  21. self.titleLabel.textColor = LZ475A7DColor;
  22. self.titleLabel.textAlignment = NSTextAlignmentCenter;
  23. self.titleLabel.text = @"按住 说话";
  24. [self addSubview:self.titleLabel];
  25. // self.timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 10, KScreenWidth, 25)];
  26. self.timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 50, KScreenWidth, 20)];
  27. self.timeLabel.font = [UIFont systemFontOfSize:15];
  28. self.timeLabel.textColor = [UIColor lightGrayColor];
  29. self.timeLabel.textAlignment = NSTextAlignmentCenter;
  30. self.timeLabel.text = @"";
  31. [self addSubview:self.timeLabel];
  32. self.recordBt = [[UIButton alloc]initWithFrame:CGRectMake((KScreenWidth-224)/2, 80, 224, 92)];
  33. self.recordBt.adjustsImageWhenHighlighted = NO;
  34. // self.recordBt.backgroundColor = LCYellowColor;
  35. // self.recordBt.layer.borderWidth = 5.0;
  36. // self.recordBt.layer.borderColor = DecColorFromRGB(214, 230, 243).CGColor;
  37. // self.recordBt.layer.cornerRadius = 70;
  38. // self.recordBt.layer.masksToBounds = YES;
  39. [self.recordBt setImage:[UIImage imageNamed:@"vqu_images_vqu_images_IM_im_record_Voice"] forState:UIControlStateNormal];
  40. [self.recordBt setContentMode:UIViewContentModeCenter];
  41. [self addSubview:self.recordBt];
  42. }
  43. - (void)setRecordTime:(NSTimeInterval)recordTime {
  44. NSInteger minutes = (NSInteger)recordTime / 60;
  45. NSInteger seconds = (NSInteger)recordTime % 60;
  46. self.timeLabel.text = [NSString stringWithFormat:@"%02zd:%02zd", minutes, seconds];
  47. }
  48. - (void)setPhase:(NIMAudioRecordPhase)phase {
  49. // if(phase == AudioRecordPhaseStart) {
  50. // [self setRecordTime:0];
  51. //// _titleLabel.text = @"准备中..";
  52. // }else if(phase == AudioRecordPhaseCancelling) {
  53. //// _tipLabel.text = @"松开手指,取消发送";
  54. //// _tipBackgroundView.hidden = NO;
  55. // _titleLabel.text = @"松开手指,取消发送";
  56. // }else {
  57. //// _tipLabel.text = @"手指上滑,取消发送";
  58. //// _tipBackgroundView.hidden = YES;
  59. // _titleLabel.text = @"手指左右移动,取消发送";
  60. // }
  61. }
  62. @end