// // JCHATRecordAnimationView.m // PALifeInsurance // // Created by da zhan on 13-7-27. // Copyright (c) 2013年 pingan. All rights reserved. // #import "JCHATRecordAnimationView.h" @implementation JCHATRecordAnimationView - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code self.hidden=YES; self.layer.cornerRadius=3.0; self.clipsToBounds = YES; UIImageView *backView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; backView.image = [[UIImage imageNamed:@"chat_voice_bg"] stretchableImageWithLeftCapWidth:10 topCapHeight:10]; [self addSubview:backView]; phoneIV=[[UIImageView alloc]initWithFrame:CGRectMake(13, 10, 72, 99)]; phoneIV.image=[UIImage imageNamed:@"RecordingBkg"]; [self addSubview:phoneIV]; cancelIV = [[UIImageView alloc] initWithFrame:CGRectMake(35, 10, 72, 99)]; cancelIV.image = [UIImage imageNamed:@"voice_delete"]; cancelIV.hidden = YES; [self addSubview:cancelIV]; signalIV=[[UIImageView alloc]initWithFrame:CGRectMake(96,40, 18, 62)]; signalIV.image=[UIImage imageNamed:@"RecordingSignal001"]; [self addSubview:signalIV]; tipLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 115, 140, 25)]; tipLabel.clipsToBounds = YES; tipLabel.textColor = [UIColor whiteColor]; tipLabel.textAlignment = NSTextAlignmentCenter; tipLabel.text = YZMsg(@"上滑取消语音发送"); tipLabel.font = [UIFont boldSystemFontOfSize:16]; tipLabel.backgroundColor = [UIColor colorWithRed:193.0/255 green:98.0/255 blue:60.0/255 alpha:1]; [self addSubview:tipLabel]; } return self; } /* // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { // Drawing code } */ //切换录音和取消界面 YES:显示录音 NO:显示取消 - (void)changeRecordView:(BOOL)flag{ if (flag) { phoneIV.hidden = NO; cancelIV.hidden = YES; signalIV.hidden = NO; tipLabel.text = YZMsg(@"上滑取消语音发送"); } else { phoneIV.hidden = YES; cancelIV.hidden = NO; signalIV.hidden = YES; tipLabel.text = YZMsg(@"松开取消语音发送"); } } - (void)changeanimation:(double)lowPassResults; { // int index=arc4random()%8; // // signalIV.image=[UIImage imageNamed:[NSString stringWithFormat:@"RecordingSignal00%d",index]]; if (0