From 866620175ff7534801fb6bde89ce9719cef07467 Mon Sep 17 00:00:00 2001
From: Davin <591807572@qq.com>
Date: 星期三, 14 六月 2023 16:35:15 +0800
Subject: [PATCH] feature toolbar view fit

---
 EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m |   48 ++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m b/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m
index fdd73f4..c77fe02 100644
--- a/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m
+++ b/EZSDK/EZSDK/EZ/UIViewControllers/EZLivePlayViewController.m
@@ -116,6 +116,7 @@
     self.isStartingTalk = NO;
     self.ptzView.hidden = YES;
     self.talkView.hidden = YES;
+    _landscape = NO;
     
     if (!self.deviceInfo) {//濡傛灉娌℃湁浼燿eviceInfo,闇�涓诲姩鑾峰彇
         [self getDeviceInfo];
@@ -572,7 +573,7 @@
     {
         self.navigationController.navigationBarHidden = YES;
         self.localRecrodContraint.constant = 50;
-        self.toolBar.hidden = YES;
+//        self.toolBar.hidden = YES;
         self.largeTitleLabel.hidden = NO;
         self.largeBackButton.hidden = NO;
         self.bottomView.hidden = YES;
@@ -584,7 +585,7 @@
         [self.scrollView setTranslatesAutoresizingMaskIntoConstraints:NO];
         [self.toolBar setTranslatesAutoresizingMaskIntoConstraints:NO];
         [NSLayoutConstraint deactivateConstraints:@[self.scrollViewWHRatio]];
-        self.scrollViewWHRatio = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.scrollView attribute:NSLayoutAttributeHeight multiplier:tureScreenH/tureScreenW constant:0];
+        self.scrollViewWHRatio = [NSLayoutConstraint constraintWithItem:self.scrollView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.scrollView attribute:NSLayoutAttributeHeight multiplier:tureScreenH/(tureScreenW - 37) constant:0];
         [NSLayoutConstraint activateConstraints:@[self.scrollViewWHRatio]];
         dispatch_async(dispatch_get_main_queue(), ^{
             [self.scrollView layoutIfNeeded];
@@ -858,9 +859,13 @@
 
 - (IBAction)large:(id)sender
 {
+    if (_landscape == YES) {
+        [self largeBack:self.largeBackButton];
+        return;
+    }
     NSLog(@"######杩涘叆妯睆锛�");
+    _landscape = YES;
     if (@available(iOS 16.0, *)) {
-        _landscape = YES;
         if (self.navigationController) {
             dispatch_async(dispatch_get_main_queue(), ^{
                 [self.navigationController setNeedsUpdateOfSupportedInterfaceOrientations];
@@ -886,8 +891,8 @@
 - (IBAction)largeBack:(id)sender
 {
     NSLog(@"######鏀跺洖妯睆锛�");
+    _landscape = NO;
     if (@available(iOS 16.0, *)) {
-        _landscape = NO;
         if (self.navigationController) {
             dispatch_async(dispatch_get_main_queue(), ^{
                 [self.navigationController setNeedsUpdateOfSupportedInterfaceOrientations];
@@ -1407,17 +1412,41 @@
     }
     CGFloat averageWidth = [UIScreen mainScreen].bounds.size.width/5.0;
     UIImageView *lineImageView1 = [UIView dd_instanceVerticalLine:20 color:[UIColor grayColor]];
-    lineImageView1.frame = CGRectMake(averageWidth, 7, lineImageView1.frame.size.width, lineImageView1.frame.size.height);
+//    lineImageView1.frame = CGRectMake(averageWidth, 7, lineImageView1.frame.size.width, lineImageView1.frame.size.height);
     [self.toolBar addSubview:lineImageView1];
+    [lineImageView1 mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(self.playButton.mas_right);
+        make.centerY.mas_equalTo(self.playButton.mas_centerY);
+        make.width.mas_equalTo(lineImageView1.frame.size.width);
+        make.height.mas_equalTo(lineImageView1.frame.size.height);
+    }];
     UIImageView *lineImageView2 = [UIView dd_instanceVerticalLine:20 color:[UIColor grayColor]];
-    lineImageView2.frame = CGRectMake(averageWidth * 2, 7, lineImageView2.frame.size.width, lineImageView2.frame.size.height);
+//    lineImageView2.frame = CGRectMake(averageWidth * 2, 7, lineImageView2.frame.size.width, lineImageView2.frame.size.height);
     [self.toolBar addSubview:lineImageView2];
+    [lineImageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(self.voiceButton.mas_right);
+        make.centerY.mas_equalTo(self.voiceButton.mas_centerY);
+        make.width.mas_equalTo(lineImageView2.frame.size.width);
+        make.height.mas_equalTo(lineImageView2.frame.size.height);
+    }];
     UIImageView *lineImageView3 = [UIView dd_instanceVerticalLine:20 color:[UIColor grayColor]];
-    lineImageView3.frame = CGRectMake(averageWidth * 3, 7, lineImageView3.frame.size.width, lineImageView3.frame.size.height);
+//    lineImageView3.frame = CGRectMake(averageWidth * 3, 7, lineImageView3.frame.size.width, lineImageView3.frame.size.height);
     [self.toolBar addSubview:lineImageView3];
+    [lineImageView3 mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(self.qualityButton.mas_right);
+        make.centerY.mas_equalTo(self.qualityButton.mas_centerY);
+        make.width.mas_equalTo(lineImageView3.frame.size.width);
+        make.height.mas_equalTo(lineImageView3.frame.size.height);
+    }];
     UIImageView *lineImageView4 = [UIView dd_instanceVerticalLine:20 color:[UIColor grayColor]];
-    lineImageView4.frame = CGRectMake(averageWidth * 4, 7, lineImageView4.frame.size.width, lineImageView4.frame.size.height);
+//    lineImageView4.frame = CGRectMake(averageWidth * 4, 7, lineImageView4.frame.size.width, lineImageView4.frame.size.height);
     [self.toolBar addSubview:lineImageView4];
+    [lineImageView4 mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(self.emptyButton.mas_right);
+        make.centerY.mas_equalTo(self.emptyButton.mas_centerY);
+        make.width.mas_equalTo(lineImageView4.frame.size.width);
+        make.height.mas_equalTo(lineImageView4.frame.size.height);
+    }];
 }
 
 
@@ -1518,5 +1547,8 @@
     }
 }
 
+- (BOOL)prefersHomeIndicatorAutoHidden {
+    return YES;
+}
 
 @end

--
Gitblit v1.8.0