Browse Source

1.图片预览 新需求 ---进行中

huangxiaodong 1 year ago
parent
commit
888d6fa7e0
14 changed files with 283 additions and 61 deletions
  1. 2 0
      创维盒子/双子星云手机/AppDelegate/AppDelegate.h
  2. 4 0
      创维盒子/双子星云手机/AppDelegate/AppDelegate.m
  3. 22 0
      创维盒子/双子星云手机/Assets.xcassets/Set/edit_del_white_icon.imageset/Contents.json
  4. BIN
      创维盒子/双子星云手机/Assets.xcassets/Set/edit_del_white_icon.imageset/edit_del_white_icon@2x.png
  5. BIN
      创维盒子/双子星云手机/Assets.xcassets/Set/edit_del_white_icon.imageset/edit_del_white_icon@3x.png
  6. 22 0
      创维盒子/双子星云手机/Assets.xcassets/Set/edit_download_white_icon.imageset/Contents.json
  7. BIN
      创维盒子/双子星云手机/Assets.xcassets/Set/edit_download_white_icon.imageset/edit_download_white_icon@2x.png
  8. BIN
      创维盒子/双子星云手机/Assets.xcassets/Set/edit_download_white_icon.imageset/edit_download_white_icon@3x.png
  9. 22 0
      创维盒子/双子星云手机/Assets.xcassets/Set/edit_share_white_icon.imageset/Contents.json
  10. BIN
      创维盒子/双子星云手机/Assets.xcassets/Set/edit_share_white_icon.imageset/edit_share_white_icon@2x.png
  11. BIN
      创维盒子/双子星云手机/Assets.xcassets/Set/edit_share_white_icon.imageset/edit_share_white_icon@3x.png
  12. 136 27
      创维盒子/双子星云手机/Class/Set/previewFile/imageDetailsScrollViewController.m
  13. 1 1
      创维盒子/双子星云手机/Class/Set/previewFile/view/editTypeBottomView.h
  14. 74 33
      创维盒子/双子星云手机/Class/Set/previewFile/view/editTypeBottomView.m

+ 2 - 0
创维盒子/双子星云手机/AppDelegate/AppDelegate.h

@@ -31,6 +31,8 @@
 @property (nonatomic, strong) NASMsgModel * NASMsgMod;
 @property (nonatomic, copy) NSString * NASShareFileService;//走公网的
 @property (nonatomic, copy) NSString * NASFileByBoxService;//本盒子的IP
+
+@property (nonatomic, assign)BOOL supportScreenRotateType;
 +(AppDelegate*)sharedAppDelegate;
 @end
 

+ 4 - 0
创维盒子/双子星云手机/AppDelegate/AppDelegate.m

@@ -142,6 +142,10 @@
         return (UIInterfaceOrientationMask)orientationMask;
     }
     
+    if(self.supportScreenRotateType){
+        return UIInterfaceOrientationMaskAllButUpsideDown;
+    }
+    
     return UIInterfaceOrientationMaskPortrait;
 }
 

+ 22 - 0
创维盒子/双子星云手机/Assets.xcassets/Set/edit_del_white_icon.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "edit_del_white_icon@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "edit_del_white_icon@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
创维盒子/双子星云手机/Assets.xcassets/Set/edit_del_white_icon.imageset/edit_del_white_icon@2x.png


BIN
创维盒子/双子星云手机/Assets.xcassets/Set/edit_del_white_icon.imageset/edit_del_white_icon@3x.png


+ 22 - 0
创维盒子/双子星云手机/Assets.xcassets/Set/edit_download_white_icon.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "edit_download_white_icon@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "edit_download_white_icon@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
创维盒子/双子星云手机/Assets.xcassets/Set/edit_download_white_icon.imageset/edit_download_white_icon@2x.png


BIN
创维盒子/双子星云手机/Assets.xcassets/Set/edit_download_white_icon.imageset/edit_download_white_icon@3x.png


+ 22 - 0
创维盒子/双子星云手机/Assets.xcassets/Set/edit_share_white_icon.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "edit_share_white_icon@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "edit_share_white_icon@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
创维盒子/双子星云手机/Assets.xcassets/Set/edit_share_white_icon.imageset/edit_share_white_icon@2x.png


BIN
创维盒子/双子星云手机/Assets.xcassets/Set/edit_share_white_icon.imageset/edit_share_white_icon@3x.png


+ 136 - 27
创维盒子/双子星云手机/Class/Set/previewFile/imageDetailsScrollViewController.m

@@ -18,6 +18,7 @@
 }
 @property (nonatomic,strong) SDCycleScrollView *curScrollView;
 @property(nonatomic,strong) editTypeBottomView*curEditTypeBottomView;
+@property(nonatomic,assign) BOOL isPortraitType;//竖屏状态
 @end
 
 @implementation imageDetailsScrollViewController
@@ -29,40 +30,119 @@
     [self.toolBar setHidden:YES];
     [self.navigationBar setHidden:YES];
     [self.navBarBGView setHidden:NO];
-    self.navBarBGView.backgroundColor = [UIColor whiteColor];
-    [self.view setBackgroundColor:[UIColor whiteColor]];
+    self.navBarBGView.backgroundColor = [UIColor clearColor];
+    
+    self.titleLabel.textColor = [UIColor whiteColor];
+    [self.backBtn setImage:[UIImage imageNamed:@"icon_white_back"] forState:UIControlStateNormal];
+    
+    [self.view setBackgroundColor:[UIColor blackColor]];
     
     [self drawAnyView];
+    _isPortraitType = YES;
 }
 
 - (void)drawAnyView
 {
+    // gradient
+    CAGradientLayer *gl = [CAGradientLayer layer];
+    gl.frame = CGRectMake(0,0,SCREEN_W,60 + AdaptTabHeight);
+    gl.startPoint = CGPointMake(0.5, 0);
+    gl.endPoint = CGPointMake(0.5, 1);
+    gl.colors = @[(__bridge id)[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1.0].CGColor, (__bridge id)[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.0].CGColor];
+    gl.locations = @[@(0), @(1.0f)];
+    //[self.layer addSublayer:gl];
+    [self.navBarBGView.layer insertSublayer:gl atIndex:0];
+}
+
+- (void)viewDidAppear:(BOOL)animated
+{
+    [super viewDidAppear:animated];
     
-    _curEditTypeBottomView = [[editTypeBottomView alloc] init];
-    [self.view addSubview:_curEditTypeBottomView];
+    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
+    ksharedAppDelegate.supportScreenRotateType = YES;
+    
+    //开始生成 设备旋转 通知
+   [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
+
+   //添加 设备旋转 通知
+   [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientChange:)  name:UIDeviceOrientationDidChangeNotification object:nil];
+}
+
+- (void)viewWillDisappear:(BOOL)animated {
+    [super viewWillDisappear:animated];
+    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDarkContent];
+    ksharedAppDelegate.supportScreenRotateType = NO;
+    
+    //销毁 设备旋转 通知
+    [[NSNotificationCenter defaultCenter] removeObserver:self
+                                                    name:UIDeviceOrientationDidChangeNotification
+                                                  object:nil];
+ 
+    //结束 设备旋转通知
+    [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
+}
+
+- (BOOL)shouldAutorotate {
+    return YES;
+}
+
+/// 如果不好用则copy VC中 加一下
+- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
+    return UIInterfaceOrientationMaskAllButUpsideDown;
+}
+
+/**屏幕旋转的通知回调*/
+- (void)orientChange:(NSNotification *)noti {
+    UIDeviceOrientation  orient = [UIDevice currentDevice].orientation;
+    switch (orient) {
+        case UIDeviceOrientationPortrait:
+            NSLog(@"竖直屏幕");
+            if(!_isPortraitType){
+                [self screenLandscapeToPortraitFun];
+            }
+            break;
+        case UIDeviceOrientationLandscapeLeft:
+            NSLog(@"手机左转");
+            if(_isPortraitType){
+                [self screenPortraitToLandscapeFun];
+            }
+            break;
+        case UIDeviceOrientationPortraitUpsideDown:
+           // NSLog(@"手机竖直");
+            break;
+        case UIDeviceOrientationLandscapeRight:
+            NSLog(@"手机右转");
+            if(_isPortraitType){
+                [self screenPortraitToLandscapeFun];
+            }
+            break;
+        case UIDeviceOrientationUnknown:
+            //NSLog(@"未知");
+            break;
+        case UIDeviceOrientationFaceUp:
+            //NSLog(@"手机屏幕朝上");
+            break;
+        case UIDeviceOrientationFaceDown:
+            //NSLog(@"手机屏幕朝下");
+            break;
+        default:
+            break;
+    }
+}
+
+#pragma mark 竖屏转横屏
+- (void)screenPortraitToLandscapeFun{
+    _isPortraitType = NO;
     _curEditTypeBottomView.hidden = YES;
-    [_curEditTypeBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.mas_equalTo(0);
-        make.right.mas_equalTo(0);
-        make.bottom.mas_equalTo(0);
-        make.height.mas_equalTo(60 + AdaptTabHeight);
-    }];
+    self.navBarBGView.hidden = YES;
+}
+
+#pragma mark 横屏转竖屏
+- (void)screenLandscapeToPortraitFun{
+    _isPortraitType = YES;
+    _curEditTypeBottomView.hidden = NO;
+    self.navBarBGView.hidden = NO;
     
-    KWeakSelf
-#pragma mark 编辑状态的 下载 分享 删除 响应事件
-    _curEditTypeBottomView.didClickButtonFun = ^(NSInteger tag) {
-        if(tag==1){
-            //[[iToast makeText:@"点击下载"] show];
-            [weakSelf gotoDownLoadFileFun];
-        }
-        else if(tag==2){
-            [weakSelf gotoShareViewFun];
-        }
-        else if(tag==3){
-            //[[iToast makeText:@"点击删除"] show];
-            [weakSelf showDeleteAlearViewFun];
-        }
-    };
 }
 
 #pragma mark 用户点击分享
@@ -103,13 +183,15 @@
     _curScrollView.infiniteLoop = NO;
     _curScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFit;
     //_curScrollView.placeholderImage = [UIImage imageNamed:@"uploadFile_image"];
-    [self.view addSubview:_curScrollView];
+    //[self.view addSubview:_curScrollView];
+    [self.view insertSubview:_curScrollView belowSubview:self.navBarBGView];
     _curScrollView.backgroundColor = [UIColor blackColor];
     
     [_curScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.mas_equalTo(0);
         make.right.mas_equalTo(0);
-        make.top.equalTo(self.navBarBGView.mas_bottom).offset(0);
+        //make.top.equalTo(self.navBarBGView.mas_bottom).offset(0);
+        make.top.mas_equalTo(0);
         //make.bottom.mas_equalTo(-(60+ AdaptTabHeight));
         make.bottom.mas_equalTo(0);
     }];
@@ -127,6 +209,33 @@
         [weakSelf setTitleLabelTextFunBy:currentIndex];
         [weakSelf cycleScrollViewDidScrollToIndex:currentIndex];
     };
+    
+    _curEditTypeBottomView = [[editTypeBottomView alloc] init];
+    _curEditTypeBottomView.isBlackType = YES;
+    [self.view addSubview:_curEditTypeBottomView];
+    //_curEditTypeBottomView.hidden = YES;
+    [_curEditTypeBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(0);
+        make.right.mas_equalTo(0);
+        make.bottom.mas_equalTo(0);
+        make.height.mas_equalTo(60 + AdaptTabHeight);
+    }];
+    
+    //KWeakSelf
+#pragma mark 编辑状态的 下载 分享 删除 响应事件
+    _curEditTypeBottomView.didClickButtonFun = ^(NSInteger tag) {
+        if(tag==1){
+            //[[iToast makeText:@"点击下载"] show];
+            [weakSelf gotoDownLoadFileFun];
+        }
+        else if(tag==2){
+            [weakSelf gotoShareViewFun];
+        }
+        else if(tag==3){
+            //[[iToast makeText:@"点击删除"] show];
+            [weakSelf showDeleteAlearViewFun];
+        }
+    };
 }
 
 - (void)setTitleLabelTextFunBy:(NSInteger)index

+ 1 - 1
创维盒子/双子星云手机/Class/Set/previewFile/view/editTypeBottomView.h

@@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface editTypeBottomView : UIView
 @property (nonatomic,copy) void (^didClickButtonFun)(NSInteger tag);
-
+@property (nonatomic,assign) BOOL isBlackType;//黑色底部
 
 - (void)setButtonStateFunBy:(BOOL)canClick;
 - (void)setCanShaewFunBy:(BOOL)canShare;

+ 74 - 33
创维盒子/双子星云手机/Class/Set/previewFile/view/editTypeBottomView.m

@@ -9,8 +9,16 @@
 
 @interface editTypeBottomView ()
 @property(nonatomic,strong) UIButton*leftButton;
+@property(nonatomic,strong) UIImageView*leftImageV;
+@property(nonatomic,strong) UILabel *leftLabel;
+
 @property(nonatomic,strong) UIButton*rightButton;
+@property(nonatomic,strong) UIImageView*rightImageV;
+@property(nonatomic,strong) UILabel *rightLabel;
+
 @property(nonatomic,strong) UIButton*midButton;
+@property(nonatomic,strong) UIImageView*midImageV;
+@property(nonatomic,strong) UILabel *midLabel;
 @end
 
 @implementation editTypeBottomView
@@ -38,25 +46,25 @@
         make.top.mas_equalTo(0);
     }];
     
-    UIImageView *leftImageV = [[UIImageView alloc] init];
-    leftImageV.image = [UIImage imageNamed:@"edit_download_icon"];
-    [_leftButton addSubview:leftImageV];
+    _leftImageV = [[UIImageView alloc] init];
+    _leftImageV.image = [UIImage imageNamed:@"edit_download_icon"];
+    [_leftButton addSubview:_leftImageV];
     
-    [leftImageV mas_makeConstraints:^(MASConstraintMaker *make) {
+    [_leftImageV mas_makeConstraints:^(MASConstraintMaker *make) {
         make.width.mas_equalTo(25);
         make.height.mas_equalTo(25);
         make.centerX.equalTo(_leftButton.mas_centerX);
         make.centerY.equalTo(_leftButton.mas_centerY).offset(-10);
     }];
     
-    UILabel *leftLabel = [[UILabel alloc] init];
-    leftLabel.textColor = [UIColor hwColor:@"#0A132B"];
-    leftLabel.textAlignment = NSTextAlignmentCenter;
-    leftLabel.font = [UIFont systemFontOfSize:12.0];
-    leftLabel.text = NSLocalizedString(@"my_set_no_File_download",nil);
-    [_leftButton addSubview:leftLabel];
+    _leftLabel = [[UILabel alloc] init];
+    _leftLabel.textColor = [UIColor hwColor:@"#0A132B"];
+    _leftLabel.textAlignment = NSTextAlignmentCenter;
+    _leftLabel.font = [UIFont systemFontOfSize:12.0];
+    _leftLabel.text = NSLocalizedString(@"my_set_no_File_download",nil);
+    [_leftButton addSubview:_leftLabel];
     
-    [leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+    [_leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
         make.width.mas_equalTo(curButFullWidth);
         make.height.mas_equalTo(25);
         make.centerX.equalTo(_leftButton.mas_centerX);
@@ -75,25 +83,25 @@
         make.top.mas_equalTo(0);
     }];
     
-    UIImageView *midImageV = [[UIImageView alloc] init];
-    midImageV.image = [UIImage imageNamed:@"edit_share_icon"];
-    [_midButton addSubview:midImageV];
+    _midImageV = [[UIImageView alloc] init];
+    _midImageV.image = [UIImage imageNamed:@"edit_share_icon"];
+    [_midButton addSubview:_midImageV];
     
-    [midImageV mas_makeConstraints:^(MASConstraintMaker *make) {
+    [_midImageV mas_makeConstraints:^(MASConstraintMaker *make) {
         make.width.mas_equalTo(25);
         make.height.mas_equalTo(25);
         make.centerX.equalTo(_midButton.mas_centerX);
         make.centerY.equalTo(_midButton.mas_centerY).offset(-10);
     }];
     
-    UILabel *midLabel = [[UILabel alloc] init];
-    midLabel.textColor = [UIColor hwColor:@"#0A132B"];
-    midLabel.textAlignment = NSTextAlignmentCenter;
-    midLabel.font = [UIFont systemFontOfSize:12.0];
-    midLabel.text = NSLocalizedString(@"common_edit_share",nil);
-    [_midButton addSubview:midLabel];
+    _midLabel = [[UILabel alloc] init];
+    _midLabel.textColor = [UIColor hwColor:@"#0A132B"];
+    _midLabel.textAlignment = NSTextAlignmentCenter;
+    _midLabel.font = [UIFont systemFontOfSize:12.0];
+    _midLabel.text = NSLocalizedString(@"common_edit_share",nil);
+    [_midButton addSubview:_midLabel];
     
-    [midLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+    [_midLabel mas_makeConstraints:^(MASConstraintMaker *make) {
         make.width.mas_equalTo(curButFullWidth);
         make.height.mas_equalTo(25);
         make.centerX.equalTo(_midButton.mas_centerX);
@@ -113,25 +121,25 @@
         make.top.mas_equalTo(0);
     }];
     
-    UIImageView *rightImageV = [[UIImageView alloc] init];
-    rightImageV.image = [UIImage imageNamed:@"edit_del_icon"];
-    [_rightButton addSubview:rightImageV];
+    _rightImageV = [[UIImageView alloc] init];
+    _rightImageV.image = [UIImage imageNamed:@"edit_del_icon"];
+    [_rightButton addSubview:_rightImageV];
     
-    [rightImageV mas_makeConstraints:^(MASConstraintMaker *make) {
+    [_rightImageV mas_makeConstraints:^(MASConstraintMaker *make) {
         make.width.mas_equalTo(25);
         make.height.mas_equalTo(25);
         make.centerX.equalTo(_rightButton.mas_centerX);
         make.centerY.equalTo(_rightButton.mas_centerY).offset(-10);
     }];
     
-    UILabel *rightLabel = [[UILabel alloc] init];
-    rightLabel.textColor = [UIColor hwColor:@"#0A132B"];
-    rightLabel.textAlignment = NSTextAlignmentCenter;
-    rightLabel.font = [UIFont systemFontOfSize:12.0];
-    rightLabel.text = NSLocalizedString(@"File_upload_Record_delete",nil);
-    [_rightButton addSubview:rightLabel];
+    _rightLabel = [[UILabel alloc] init];
+    _rightLabel.textColor = [UIColor hwColor:@"#0A132B"];
+    _rightLabel.textAlignment = NSTextAlignmentCenter;
+    _rightLabel.font = [UIFont systemFontOfSize:12.0];
+    _rightLabel.text = NSLocalizedString(@"File_upload_Record_delete",nil);
+    [_rightButton addSubview:_rightLabel];
     
-    [rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+    [_rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
         make.width.mas_equalTo(curButFullWidth);
         make.height.mas_equalTo(25);
         make.centerX.equalTo(_rightButton.mas_centerX);
@@ -216,4 +224,37 @@
         }];
     }
 }
+
+- (void)setIsBlackType:(BOOL)isBlackType
+{
+    _isBlackType = isBlackType;
+    if(isBlackType){
+        self.backgroundColor = [UIColor clearColor];
+        
+        // gradient
+        CAGradientLayer *gl = [CAGradientLayer layer];
+        gl.frame = CGRectMake(0,0,SCREEN_W,60 + AdaptTabHeight);
+        gl.startPoint = CGPointMake(0.5, 0);
+        gl.endPoint = CGPointMake(0.5, 1);
+        gl.colors = @[(__bridge id)[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.0].CGColor, (__bridge id)[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1.0].CGColor];
+        gl.locations = @[@(0), @(1.0f)];
+        //[self.layer addSublayer:gl];
+        [self.layer insertSublayer:gl atIndex:0];
+        
+        self.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.0200].CGColor;
+        self.layer.shadowOffset = CGSizeMake(0,-1);
+        self.layer.shadowOpacity = 1;
+        self.layer.shadowRadius = 1;
+        
+        //
+        _leftImageV.image = [UIImage imageNamed:@"edit_download_white_icon"];
+        _leftLabel.textColor = [UIColor whiteColor];
+        
+        _midImageV.image = [UIImage imageNamed:@"edit_share_white_icon"];
+        _midLabel.textColor = [UIColor whiteColor];
+        
+        _rightImageV.image = [UIImage imageNamed:@"edit_del_white_icon"];
+        _rightLabel.textColor = [UIColor whiteColor];
+    }
+}
 @end