123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- //
- // recordingView.m
- // 双子星云手机
- //
- // Created by xd h on 2025/3/28.
- //
- #import "recordingView.h"
- #import "AudioRecorderManager.h"
- @implementation recordingView
- - (id)initWithFrame:(CGRect)frame{
- self = [super initWithFrame:frame];
-
- self.backgroundColor = [UIColor hwColor:@"000000" alpha:0.6];
- [self drawAnyView];
-
- return self;
- }
- -(void)drawAnyView{
-
- UIView *whiteBgView = [[UIView alloc] init];
- whiteBgView.backgroundColor = [UIColor whiteColor];
- [self addSubview:whiteBgView];
-
- [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0.f);
- make.height.mas_equalTo(238.f + AdaptTabHeight);
- make.right.mas_equalTo(0.f);
- make.bottom.mas_equalTo(0.f);
- }];
-
- /*上圆角*/
- UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W, 238.f + AdaptTabHeight)
- byRoundingCorners:UIRectCornerTopLeft|UIRectCornerTopRight
- cornerRadii:CGSizeMake(12, 12)];
- CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
- maskLayer.frame = CGRectMake(0, 0, SCREEN_W, 238.f + AdaptTabHeight);
- maskLayer.path = maskPath.CGPath;
- whiteBgView.layer.mask = maskLayer;
- UIButton *recordBut = [[UIButton alloc] init];
- [recordBut setBackgroundImage:[UIImage imageNamed:@"white_record_end_icon"] forState:UIControlStateNormal];
- [recordBut addTarget:self action:@selector(didClickButFun) forControlEvents:UIControlEventTouchUpInside];
- [whiteBgView addSubview:recordBut];
-
- [recordBut mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(78.f);
- make.height.mas_equalTo(78.f);
- make.centerX.mas_equalTo(0.f);
- make.bottom.mas_equalTo(-12.f - AdaptTabHeight);
- }];
-
- //
- UIImageView *recordingTipImageView = [[UIImageView alloc] init];
- recordingTipImageView.image = [UIImage imageNamed:@"recording_tip"];
- [whiteBgView addSubview:recordingTipImageView];
-
- [recordingTipImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(323.f*AUTOSCALE);
- make.height.mas_equalTo(52.f*AUTOSCALE);
- make.centerX.mas_equalTo(0.f);
- make.bottom.equalTo(recordBut.mas_top).offset(-20);
- }];
-
-
- }
- #pragma mark 开始录音
- - (void)beginRecordFun
- {
- [[AudioRecorderManager sharedManager] startRecording];
- }
- - (void)didClickButFun
- {
- [[AudioRecorderManager sharedManager] stopRecording];
- if (_didClickRecordEndFun) {
- _didClickRecordEndFun();
- }
- }
- @end
|