瀏覽代碼

1.分享横屏UI样式

huangxiaodong 1 年之前
父節點
當前提交
00916ba596

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

@@ -25,6 +25,7 @@
 
 @property(nonatomic,strong) previewLandscapeTopView*previewLandscapeTopV;
 @property(nonatomic,strong) previewLandscapeTopMoreView*previewLandscapeTopMoreV;
+@property(nonatomic,strong)  editShareView *editShareV;
 
 @property(nonatomic,assign) BOOL isHideMsgType;//隐藏上下信息
 @end
@@ -172,6 +173,10 @@
         make.height.mas_equalTo(60);
     }];
     
+    if(_editShareV){
+        _editShareV.isPortraitType = _isPortraitType;
+    }
+    
     //[_curScrollView.mainView reloadData];
     //[_curScrollView adjustWhenControllerViewWillAppera];
     
@@ -192,6 +197,10 @@
     
     [self didClickScreenFun:NO];
     
+    if(_editShareV){
+        _editShareV.isPortraitType = _isPortraitType;
+    }
+    
     //[_curScrollView.mainView reloadData];
     //[self deletePreviewLandscapeTopMoreViewFun];
 //    if(_index >= 1){
@@ -203,15 +212,17 @@
 #pragma mark 用户点击分享
 - (void)gotoShareViewFun
 {
-    editShareView *editShareV = [[editShareView alloc] init];
+    _editShareV = [[editShareView alloc] init];
     
     NASFilePicDataArrModel *dataModel = _totalDataArr[_index];
-    editShareV.didSelectListArr = [NSMutableArray arrayWithArray:@[dataModel]];
-    editShareV.shareFileType = @"2";
+    _editShareV.didSelectListArr = [NSMutableArray arrayWithArray:@[dataModel]];
+    _editShareV.shareFileType = @"2";
+    
+    [self.view addSubview:_editShareV];
+    _editShareV.isPortraitType = _isPortraitType;
     
-    [self.view addSubview:editShareV];
     
-    [editShareV mas_makeConstraints:^(MASConstraintMaker *make) {
+    [_editShareV mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.mas_equalTo(0);
         make.right.mas_equalTo(0);
         make.bottom.mas_equalTo(0);

+ 105 - 7
创维盒子/双子星云手机/Class/Set/previewFile/videoPlayByAVPlayerViewController.m

@@ -42,7 +42,8 @@
 @property (nonatomic, strong)UIButton *landScapeToPortraitBtn;
 @property (nonatomic, strong)UIButton *landScapeTopMoreBtn;
 @property (nonatomic, strong)previewVideoLandscapeTopMoreView *previewVideoLandscapeTopMoreV;
-
+@property(nonatomic,strong)  editShareView *editShareV;
+@property(nonatomic,assign) BOOL isPortraitType;//竖屏状态
 @end
 
 @implementation videoPlayByAVPlayerViewController
@@ -148,11 +149,25 @@
         
         [self customControlViewUIFun];
     }
+    
+    //开始生成 设备旋转 通知
+   [[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];
+    
+    //销毁 设备旋转 通知
+    [[NSNotificationCenter defaultCenter] removeObserver:self
+                                                    name:UIDeviceOrientationDidChangeNotification
+                                                  object:nil];
+ 
+    //结束 设备旋转通知
+    [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
 }
 
 
@@ -160,6 +175,88 @@
     return NO;
 }
 
+/**屏幕旋转的通知回调*/
+- (void)orientChange:(NSNotification *)noti {
+    UIDeviceOrientation  orient = [UIDevice currentDevice].orientation;
+    switch (orient) {
+        case UIDeviceOrientationPortrait:
+            NSLog(@"竖直屏幕");
+            if(!_isPortraitType){
+                [self.player rotateToOrientation:UIInterfaceOrientationPortrait animated:NO completion:^{
+                    [self screenLandscapeToPortraitFun];
+                }];
+            }
+            break;
+        case UIDeviceOrientationLandscapeLeft:
+            NSLog(@"手机左转");
+            if(_isPortraitType){
+                [self.player rotateToOrientation:UIInterfaceOrientationLandscapeRight animated:NO completion:^{
+                    [self screenPortraitToLandscapeFun];
+                }];
+            }
+            break;
+        case UIDeviceOrientationPortraitUpsideDown:
+           // NSLog(@"手机竖直");
+            break;
+        case UIDeviceOrientationLandscapeRight:
+            NSLog(@"手机右转");
+            if(_isPortraitType){
+                [self.player rotateToOrientation:UIInterfaceOrientationLandscapeLeft animated:NO completion:^{
+                    [self screenPortraitToLandscapeFun];
+                }];
+                
+            }
+            break;
+        case UIDeviceOrientationUnknown:
+            //NSLog(@"未知");
+            break;
+        case UIDeviceOrientationFaceUp:
+            //NSLog(@"手机屏幕朝上");
+            break;
+        case UIDeviceOrientationFaceDown:
+            //NSLog(@"手机屏幕朝下");
+            break;
+        default:
+            break;
+    }
+}
+
+#pragma mark 竖屏转横屏
+- (void)screenPortraitToLandscapeFun{
+    _isPortraitType = NO;
+    if(_editShareV){
+        _editShareV.isPortraitType = _isPortraitType;
+        [_controlView.landScapeControlView addSubview:_editShareV];
+        
+        [self->_editShareV mas_remakeConstraints:^(MASConstraintMaker *make) {
+            make.left.mas_equalTo(0);
+            make.right.mas_equalTo(0);
+            make.bottom.mas_equalTo(0);
+            make.top.mas_equalTo(0);
+        }];
+        
+    }
+}
+
+#pragma mark 横屏转竖屏
+- (void)screenLandscapeToPortraitFun{
+    _isPortraitType = YES;
+    
+    if(_editShareV){
+        _editShareV.isPortraitType = _isPortraitType;
+        [self.view addSubview:_editShareV];
+        
+        [_editShareV mas_remakeConstraints:^(MASConstraintMaker *make) {
+            make.left.mas_equalTo(0);
+            make.right.mas_equalTo(0);
+            make.bottom.mas_equalTo(0);
+            make.top.mas_equalTo(0);
+        }];
+    }
+    
+}
+
+
 /// 如果不好用则copy VC中 加一下
 - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
     if (self.player.isFullScreen) {
@@ -428,18 +525,19 @@
         return;
     }
     
-    editShareView *editShareV = [[editShareView alloc] init];
-    editShareV.didSelectListArr = [NSMutableArray arrayWithArray:@[_VideoDataMode]];
-    editShareV.shareFileType = @"3";
+    _editShareV = [[editShareView alloc] init];
+    _editShareV.didSelectListArr = [NSMutableArray arrayWithArray:@[_VideoDataMode]];
+    _editShareV.shareFileType = @"3";
     if(isLandscapeType){
-        [_controlView.landScapeControlView addSubview:editShareV];
+        _editShareV.isPortraitType = NO;
+        [_controlView.landScapeControlView addSubview:_editShareV];
     }
     else{
-        [self.view addSubview:editShareV];
+        [self.view addSubview:_editShareV];
     }
     
     
-    [editShareV mas_makeConstraints:^(MASConstraintMaker *make) {
+    [_editShareV mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.mas_equalTo(0);
         make.right.mas_equalTo(0);
         make.bottom.mas_equalTo(0);

+ 2 - 0
创维盒子/双子星云手机/Class/Set/previewFile/view/editShareView.h

@@ -13,6 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, copy)  NSString *shareFileType; //文件类型 1=应用 2=图片 3=视频 4=音频 5=文档 6=文件
 @property (nonatomic, strong)  NSMutableArray*didSelectListArr;//选中的数据
 @property (nonatomic, assign) BOOL isLastFileType;
+
+@property (nonatomic, assign) BOOL isPortraitType;//竖屏模式
 @end
 
 NS_ASSUME_NONNULL_END

+ 122 - 29
创维盒子/双子星云手机/Class/Set/previewFile/view/editShareView.m

@@ -20,6 +20,9 @@
 #import <TencentOpenAPI/QQApiInterfaceObject.h>
 
 @interface editShareView ()<UITextFieldDelegate>
+
+@property(nonatomic,strong) UIView *whiteBgView;
+
 @property(nonatomic,strong) UIButton*day7Button;
 @property(nonatomic,strong) UIButton*dayForeverButton;
 
@@ -27,6 +30,10 @@
 @property(nonatomic,strong) UITextField *shareNumberTF;
 @property(nonatomic,strong) UIButton*reduceButton;//-
 
+@property(nonatomic,strong)UILabel *thridTitleLabel;
+@property(nonatomic,strong) UIButton*wxShareButton;
+@property(nonatomic,strong) UIButton*QQShareButton;
+@property(nonatomic,strong) UIButton*momentsShareButton;
 @property(nonatomic,strong) UIButton*PrivacyShareButton;
 @end
 
@@ -41,13 +48,27 @@
 
 - (void)drawAnyView{
     
-    UIView *whiteBgView = [[UIView alloc] init];
-    whiteBgView.backgroundColor = [UIColor whiteColor];
-    [self addSubview:whiteBgView];
-    whiteBgView.layer.cornerRadius = 32;
-    whiteBgView.layer.masksToBounds = YES;
+    //大按钮响应
+    UIButton *bigRightButton = [[UIButton alloc] init];
+    bigRightButton.tag = 1;
+    [bigRightButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
+    [self addSubview:bigRightButton];
+    //bigRightButton.backgroundColor= [UIColor greenColor];
+    
+    [bigRightButton mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.top.mas_equalTo(0);
+        make.left.mas_equalTo(0);
+        make.right.mas_equalTo(0);
+        make.bottom.mas_equalTo(0);
+    }];
+    
+    _whiteBgView = [[UIView alloc] init];
+    _whiteBgView.backgroundColor = [UIColor whiteColor];
+    [self addSubview:_whiteBgView];
+    _whiteBgView.layer.cornerRadius = 32;
+    _whiteBgView.layer.masksToBounds = YES;
     
-    [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
+    [_whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.mas_equalTo(0);
         make.right.mas_equalTo(0);
         make.bottom.mas_equalTo(0);
@@ -58,7 +79,7 @@
     UILabel *titleLabel = [[UILabel alloc] init];
     titleLabel.font = [UIFont systemFontOfSize:18.0];
     titleLabel.textColor = [UIColor hwColor:@"#0A132B" alpha:1.0];
-    [whiteBgView addSubview:titleLabel];
+    [_whiteBgView addSubview:titleLabel];
     
     NSString *leftText = NSLocalizedString(@"share_title_left",nil);
     NSString *rightText = NSLocalizedString(@"share_title_right",nil);
@@ -83,7 +104,7 @@
     secondTitleLabel.font = [UIFont systemFontOfSize:14.0];
     secondTitleLabel.textColor = [UIColor hwColor:@"#666666" alpha:1.0];
     secondTitleLabel.text = secondTitleStr;
-    [whiteBgView addSubview:secondTitleLabel];
+    [_whiteBgView addSubview:secondTitleLabel];
     
     CGFloat secondWith = [secondTitleStr boundingRectWithSize:CGSizeMake(300, 20) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0]} context:nil].size.width;
     
@@ -103,7 +124,7 @@
     [_day7Button addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
     _day7Button.titleLabel.font = [UIFont boldSystemFontOfSize:14];
     _day7Button.tag = 1;
-    [whiteBgView addSubview:_day7Button];
+    [_whiteBgView addSubview:_day7Button];
     _day7Button.selected = YES;
     
     [_day7Button mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -121,7 +142,7 @@
     [_dayForeverButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
     _dayForeverButton.titleLabel.font = [UIFont boldSystemFontOfSize:14];
     _dayForeverButton.tag = 2;
-    [whiteBgView addSubview:_dayForeverButton];
+    [_whiteBgView addSubview:_dayForeverButton];
     
     [_dayForeverButton mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.equalTo(_day7Button.mas_right).offset(15);
@@ -132,15 +153,15 @@
     
     //1.4.1 添加分享次数限制
     NSString *thridTitleStr = NSLocalizedString(@"share_number_limit_title",nil);
-    UILabel *thridTitleLabel = [[UILabel alloc] init];
-    thridTitleLabel.font = [UIFont systemFontOfSize:14.0];
-    thridTitleLabel.textColor = [UIColor hwColor:@"#666666" alpha:1.0];
-    thridTitleLabel.text = thridTitleStr;
-    [whiteBgView addSubview:thridTitleLabel];
+    _thridTitleLabel = [[UILabel alloc] init];
+    _thridTitleLabel.font = [UIFont systemFontOfSize:14.0];
+    _thridTitleLabel.textColor = [UIColor hwColor:@"#666666" alpha:1.0];
+    _thridTitleLabel.text = thridTitleStr;
+    [_whiteBgView addSubview:_thridTitleLabel];
     
     CGFloat thridWith = [thridTitleStr boundingRectWithSize:CGSizeMake(300, 20) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0]} context:nil].size.width + 10;
     
-    [thridTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+    [_thridTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.mas_equalTo(25);
         make.width.mas_equalTo(thridWith);
         make.top.equalTo(secondTitleLabel.mas_bottom).offset(10);
@@ -152,12 +173,12 @@
     [_addButton setImage:[UIImage imageNamed:@"common_add_N"] forState:UIControlStateNormal];
     [_addButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
     _addButton.tag = 3;
-    [whiteBgView addSubview:_addButton];
+    [_whiteBgView addSubview:_addButton];
     _addButton.enabled = NO;
     
     [_addButton mas_makeConstraints:^(MASConstraintMaker *make) {
         make.right.mas_equalTo(-20);
-        make.centerY.equalTo(thridTitleLabel.mas_centerY).offset(0);
+        make.centerY.equalTo(_thridTitleLabel.mas_centerY).offset(0);
         make.width.mas_equalTo(30);
         make.height.mas_equalTo(30);
     }];
@@ -171,12 +192,12 @@
     _shareNumberTF.text = @"80";
     _shareNumberTF.delegate = self;
     _shareNumberTF.keyboardType = UIKeyboardTypeNumberPad;
-    [whiteBgView addSubview:_shareNumberTF];
+    [_whiteBgView addSubview:_shareNumberTF];
     [_shareNumberTF setTintColor:[UIColor hwColor:@"#01B7EA" alpha:1.0]];
     
     [_shareNumberTF mas_makeConstraints:^(MASConstraintMaker *make) {
         make.right.equalTo(_addButton.mas_left).offset(-5);
-        make.centerY.equalTo(thridTitleLabel.mas_centerY).offset(0);
+        make.centerY.equalTo(_thridTitleLabel.mas_centerY).offset(0);
         make.width.mas_equalTo(50);
         make.height.mas_equalTo(25);
     }];
@@ -186,11 +207,11 @@
     [_reduceButton setImage:[UIImage imageNamed:@"common_reduce_N"] forState:UIControlStateNormal];
     [_reduceButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
     _reduceButton.tag = 4;
-    [whiteBgView addSubview:_reduceButton];
+    [_whiteBgView addSubview:_reduceButton];
    
     [_reduceButton mas_makeConstraints:^(MASConstraintMaker *make) {
         make.right.equalTo(_shareNumberTF.mas_left).offset(-5);
-        make.centerY.equalTo(thridTitleLabel.mas_centerY).offset(0);
+        make.centerY.equalTo(_thridTitleLabel.mas_centerY).offset(0);
         make.width.mas_equalTo(30);
         make.height.mas_equalTo(30);
     }];
@@ -214,16 +235,25 @@
         UIButton*curButton = [[UIButton alloc] init];
         [curButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
         curButton.tag = 10+i;
-        [whiteBgView addSubview:curButton];
+        [_whiteBgView addSubview:curButton];
 
         [curButton mas_makeConstraints:^(MASConstraintMaker *make) {
             make.width.mas_equalTo(curButFullWidth);
             make.left.mas_equalTo(i*curButFullWidth);
             make.height.mas_equalTo(80);
-            make.top.equalTo(thridTitleLabel.mas_bottom).offset(20);
+            make.top.equalTo(_thridTitleLabel.mas_bottom).offset(20);
         }];
         
-        if(i== titleArr.count -1){
+        if(i== 0){
+            _wxShareButton = curButton;
+        }
+        else if(i== 1){
+            _QQShareButton = curButton;
+        }
+        else if(i== 2){
+            _momentsShareButton= curButton;
+        }
+        else if(i== 3){
             _PrivacyShareButton = curButton;
         }
         
@@ -275,7 +305,7 @@
     [cancelButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
     cancelButton.titleLabel.font = [UIFont boldSystemFontOfSize:14];
     cancelButton.tag = 100;
-    [whiteBgView addSubview:cancelButton];
+    [_whiteBgView addSubview:cancelButton];
     
     [cancelButton mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.mas_equalTo(0);
@@ -286,7 +316,7 @@
     
     UIView *lineView = [[UIView alloc] init];
     lineView.backgroundColor = [UIColor hwColor:@"#EAEAEA"];
-    [whiteBgView addSubview:lineView];
+    [_whiteBgView addSubview:lineView];
     
     [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.mas_equalTo(25);
@@ -298,7 +328,7 @@
     UILabel *tipLabel = [[UILabel alloc] init];
     tipLabel.font = [UIFont systemFontOfSize:12.0];
     tipLabel.textColor = [UIColor hwColor:@"#959799" alpha:1.0];
-    [whiteBgView addSubview:tipLabel];
+    [_whiteBgView addSubview:tipLabel];
     
     NSString *TipText = NSLocalizedString(@"share_file_tip_msg",nil);
     tipLabel.text = TipText;
@@ -357,7 +387,7 @@
         
         _addButton.enabled = YES;
     }
-    else if(tag == 100){
+    else if(tag == 100 || tag ==1){
         [self removeFromSuperview];
     }
     else{
@@ -605,5 +635,68 @@
     }
 }
 
+- (void)setIsPortraitType:(BOOL)isPortraitType
+{
+    _isPortraitType = isPortraitType;
+    
+    CGFloat curButFullWidth = 0.0;
+    
+    if(_isPortraitType){
+        _whiteBgView.layer.cornerRadius = 32;
+        [_whiteBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
+            make.left.mas_equalTo(0);
+            make.right.mas_equalTo(0);
+            make.bottom.mas_equalTo(0);
+            make.height.mas_equalTo(345 + AdaptTabHeight);
+        }];
+        
+        CGFloat width = SCREEN_W < SCREEN_H ? SCREEN_W : SCREEN_H;
+        curButFullWidth = width/4.0;
+    }
+    else{
+        CGFloat height = SCREEN_W < SCREEN_H ? SCREEN_W  : SCREEN_H;
+        
+        _whiteBgView.layer.cornerRadius = 0;
+        [_whiteBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
+            make.width.mas_equalTo(400);
+            make.right.mas_equalTo(0);
+            make.bottom.mas_equalTo(0);
+            //make.height.mas_equalTo(345 + AdaptTabHeight);
+            make.height.mas_equalTo(height);
+        }];
+        
+        curButFullWidth = 400.0/4.0;
+    }
+    
+    //四个分享按钮
+    [_wxShareButton mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.width.mas_equalTo(curButFullWidth);
+        make.left.mas_equalTo(0*curButFullWidth);
+        make.height.mas_equalTo(80);
+        make.top.equalTo(_thridTitleLabel.mas_bottom).offset(20);
+    }];
+    
+    [_QQShareButton mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.width.mas_equalTo(curButFullWidth);
+        make.left.mas_equalTo(1*curButFullWidth);
+        make.height.mas_equalTo(80);
+        make.top.equalTo(_thridTitleLabel.mas_bottom).offset(20);
+    }];
+    
+    [_momentsShareButton mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.width.mas_equalTo(curButFullWidth);
+        make.left.mas_equalTo(2*curButFullWidth);
+        make.height.mas_equalTo(80);
+        make.top.equalTo(_thridTitleLabel.mas_bottom).offset(20);
+    }];
+    
+    [_PrivacyShareButton mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.width.mas_equalTo(curButFullWidth);
+        make.left.mas_equalTo(3*curButFullWidth);
+        make.height.mas_equalTo(80);
+        make.top.equalTo(_thridTitleLabel.mas_bottom).offset(20);
+    }];
+  
+}
 @end