From ea7dfe09eaed6edbebca1d2d89a135fc0c81695e Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期五, 10 七月 2020 16:40:13 +0800 Subject: [PATCH] 2020-07-10 1.修改UI布局。 --- ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m | 57 +++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 37 insertions(+), 20 deletions(-) diff --git a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m index fbddd12..7baab16 100644 --- a/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m +++ b/ESVideoPhoneSDKZigbee/ESVideoPhoneSDKDemo/ZigBee/ESVideoMonitorViewController.m @@ -15,6 +15,7 @@ #import <Photos/Photos.h> #import "AudioSessionHelper.h" #import "CBToast.h" +#import "ESVideo.h" @interface ESVideoMonitorViewController ()<ESVideoPhoneDelegate> @@ -140,7 +141,7 @@ -(void)backAction{ [self.navigationController popViewControllerAnimated:true]; -// [self dismissViewControllerAnimated:YES completion:NULL]; + // [self dismissViewControllerAnimated:YES completion:NULL]; } - (UIButton *)moreButton{ @@ -164,7 +165,7 @@ - (void)initCentetView { [self.view addSubview:self.centerView]; - [self.centerView addSubview:self.collectButton]; + // [self.centerView addSubview:self.collectButton]; [self.centerView addSubview:self.homeView]; [self.centerView addSubview:self.screenshotImgBtn]; [self.centerView addSubview:self.screenshotTextBtn]; @@ -178,7 +179,7 @@ _centerView.backgroundColor = UIColor.whiteColor; [self setRadiusWithView:_centerView]; - _topUILabel= [[UILabel alloc] initWithFrame:CGRectMake(80, 20, APP_SCREEN_WIDTH-160, 24)]; + _topUILabel= [[UILabel alloc] initWithFrame:CGRectMake(80, GetRealHeight(20), APP_SCREEN_WIDTH-160, GetRealHeight(24))]; _topUILabel.font = [UIFont fontWithName:APP_UIFont_BOLD size:15.0]; _topUILabel.textColor = HEXCOLORA(0x333333, 1.0); // _topUILabel.text = @"浜屾纭鏈�"; @@ -229,9 +230,9 @@ - (UIView *)homeView{ if (_homeView == nil) { - _homeView = [[UIView alloc] initWithFrame:CGRectMake(0, 268, APP_SCREEN_WIDTH, 36)]; + _homeView = [[UIView alloc] initWithFrame:CGRectMake(0, GetRealHeight(268), APP_SCREEN_WIDTH, GetRealHeight(36))]; _homeView.backgroundColor = HEXCOLORA(0x232323, 1.0); - UIImageView *mUIImageView= [[UIImageView alloc] initWithFrame:CGRectMake(20, 4, 28, 28)]; + UIImageView *mUIImageView= [[UIImageView alloc] initWithFrame:CGRectMake(GetRealWidth(20), GetRealHeight(4), GetRealHeight(28), GetRealHeight(28))]; mUIImageView.image = [UIImage imageNamed:@"ic_esvideo_home"]; [mUIImageView setContentMode:UIViewContentModeScaleAspectFit]; [_homeView addSubview:mUIImageView]; @@ -243,7 +244,7 @@ - (UILabel *)homeUILabel{ if (_homeUILabel == nil) { - _homeUILabel = [[UILabel alloc] initWithFrame:CGRectMake(52, 8, APP_SCREEN_WIDTH - 100, 20)]; + _homeUILabel = [[UILabel alloc] initWithFrame:CGRectMake(GetRealWidth(52), 0, APP_SCREEN_WIDTH - GetRealWidth(100), _homeView.frame.size.height)]; _homeUILabel.font = [UIFont fontWithName:APP_UIFont size:12.0]; _homeUILabel.textColor = [UIColor whiteColor]; // _homeUILabel.text = @"1鏍�203"; @@ -255,7 +256,7 @@ - (UIButton *)screenshotImgBtn{ if (_screenshotImgBtn == nil) { - _screenshotImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(80, 404, 58, 58)]; + _screenshotImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(GetRealWidth(80), GetRealHeight(404), GetRealHeight(58), GetRealHeight(58))]; [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_unselect"] forState:UIControlStateNormal]; // [_screenshotImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_takephoto_select"] forState:UIControlStateSelected]; [_screenshotImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; @@ -284,7 +285,7 @@ - (UIButton *)screenshotTextBtn{ if (_screenshotTextBtn == nil) { - _screenshotTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(59, 470, 100, 21)]; + _screenshotTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, GetRealHeight(470), GetRealWidth(100), GetRealHeight(21))]; [_screenshotTextBtn setTitle:@"鎴浘" forState:UIControlStateNormal]; _screenshotTextBtn.titleLabel.textAlignment = NSTextAlignmentCenter; _screenshotTextBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; @@ -293,13 +294,14 @@ [_screenshotTextBtn addTarget:self action:@selector(screenshotAction) forControlEvents:UIControlEventTouchUpInside | UIControlEventTouchUpOutside]; [_screenshotTextBtn addTarget:self action:@selector(screenshotDownAction) forControlEvents:UIControlEventTouchDown]; _screenshotTextBtn.adjustsImageWhenHighlighted = NO; + _screenshotTextBtn.center = CGPointMake(_screenshotImgBtn.center.x, GetRealHeight(484)); } return _screenshotTextBtn; } - (UIButton *)unlockImgBtn{ if (_unlockImgBtn == nil) { - _unlockImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(APP_SCREEN_WIDTH-138, 404, 58, 58)]; + _unlockImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(APP_SCREEN_WIDTH-GetRealWidth(80)- GetRealHeight(58), GetRealHeight(404), GetRealHeight(58), GetRealHeight(58))]; [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_unselect"] forState:UIControlStateNormal]; // [_unlockImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_unlock_select"] forState:UIControlStateSelected]; [_unlockImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; @@ -327,7 +329,7 @@ - (UIButton *)unlockTextBtn{ if (_unlockTextBtn == nil) { - _unlockTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(216, 470, 100, 21)]; + _unlockTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(216, GetRealHeight(470), GetRealWidth(100), GetRealHeight(21))]; [_unlockTextBtn setTitle:@"寮�閿�" forState:UIControlStateNormal]; _unlockTextBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:15.0]; _unlockTextBtn.titleLabel.textAlignment = NSTextAlignmentCenter; @@ -337,6 +339,8 @@ // [_unlockTextBtn setTitleColor:TextSelectColor forState:UIControlStateSelected]; [_unlockTextBtn addTarget:self action:@selector(unlockAction) forControlEvents:UIControlEventTouchUpInside]; [_unlockTextBtn addTarget:self action:@selector(unlockDownAction) forControlEvents:UIControlEventTouchDown]; + _unlockTextBtn.adjustsImageWhenHighlighted = NO; + _unlockTextBtn.center = CGPointMake(_unlockImgBtn.center.x, GetRealHeight(484)); } return _unlockTextBtn; } @@ -397,6 +401,8 @@ #pragma SDK鍙瀵硅 鍔熻兘閮ㄥ垎 -(void)initESVideo{ //鍒濆鍖栦腑鏂紝杩涘叆鍚庡彴鐨則ag + _es = ESVideo.shareInstance.es; + _playing = NO; _isSpeaking = NO; self.isInterrupt = NO; @@ -412,13 +418,19 @@ }); }; //闂ㄥ彛鏈轰細鏈夎棰戠殑闀垮楂橈紝鏄浐瀹氱殑锛堟殏鏃惰繕涓嶇‘瀹氾級 - _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame:CGRectMake(0, 57, APP_SCREEN_WIDTH, 211) delegate:self imagecallBack:snapImageCallback]; + // _es = [[ESVideoPhone alloc]initESVideoPhoneWithFrame:CGRectMake(0, 57, APP_SCREEN_WIDTH, 211) delegate:self imagecallBack:snapImageCallback]; if (_es) { //鍒ゆ柇瑙嗛娓叉煋鏄惁鍒濆鍖栨垚鍔燂紝濡傛灉澶辫触浼氳蛋ESVideoPhoneDelegate鏂规硶 if (_es.showView) { + // for(UIView *view in [_es.showView subviews]) + // { + // [view removeFromSuperview]; + // } _es.delegate = self; + ESVideo.shareInstance.snapImageCallback = snapImageCallback; _es.showView.backgroundColor = [UIColor whiteColor]; [self.centerView addSubview:_es.showView]; + _es.showView.hidden = YES; } }else{ NSLog(@"ESVideoPhone 鍒濆鍖栧け璐�"); @@ -487,9 +499,9 @@ UIAlertController *alertController = [UIAlertController alertControllerWithTitle:tipStr message:mes preferredStyle:UIAlertControllerStyleAlert]; [alertController addAction:[UIAlertAction actionWithTitle:okStr style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { [self backAction]; - }]]; + }]]; - [self presentViewController:alertController animated:YES completion:nil]; + [self presentViewController:alertController animated:YES completion:nil]; } @@ -520,11 +532,12 @@ [_es stopTalk]; _es.delegate = nil; - - + ESVideo.shareInstance.snapImageCallback = nil; + // _es.showView.removeFromSuperview; } - [_es freeSubClass]; + + // [_es freeSubClass]; } -(void)dealloc{ @@ -560,13 +573,17 @@ }else if([phoneEventStr isEqual:@"EVT_Connected"]){ [self speaker:nil]; // [_mCallOrAccept setTitle:@"閫氳瘽涓�..." forState:UIControlStateNormal]; + }else if([phoneEventStr isEqual:@"EVT_MonitorConnected"]){ + _es.showView.hidden = NO; + [self speaker:nil]; + // [_mCallOrAccept setTitle:@"閫氳瘽涓�..." forState:UIControlStateNormal]; }else if([phoneEventStr isEqual:@"EVT_HangUp"]){ - -// [CBToast showToastAction:endOfMonitoringStr]; + + // [CBToast showToastAction:endOfMonitoringStr]; [self showUIAlertViewWithBack:endOfMonitoringStr]; -// [self backAction]; - + // [self backAction]; + // [_mCallOrAccept setTitle:@"鍙嶅懠" forState:UIControlStateNormal]; -- Gitblit v1.8.0