Forráskód Böngészése

1.上传文件加号按钮可以拖拽

huangxiaodong 8 hónapja%!(EXTRA string=óta)
szülő
commit
2fd76241b8

+ 21 - 0
创维盒子/code/Class/Set/previewFile/previewAudioOrDocumentViewController.m

@@ -169,6 +169,10 @@
         make.bottom.mas_equalTo(-30 - AdaptTabHeight);
     }];
     
+    // 添加拖拽手势
+   UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
+   [_uploadFileButton addGestureRecognizer:panGesture];
+
     NSMutableArray *arr = [NSMutableArray new];
     NSArray *diskList = ksharedAppDelegate.cloudPhoneExtraFileListMod.data;
     if(diskList && [diskList isKindOfClass:[NSArray class]]){
@@ -273,6 +277,23 @@
     
 }
 
+#pragma mark 处理拖拽手势
+- (void)handlePan:(UIPanGestureRecognizer *)gesture {
+    if (gesture.state == UIGestureRecognizerStateChanged) {
+        // 获取手指拖拽的偏移量
+        CGPoint translation = [gesture translationInView:self.view];
+        
+        // 更新视图位置
+        CGPoint newCenter = CGPointMake(
+            _uploadFileButton.center.x + translation.x,
+            _uploadFileButton.center.y + translation.y
+        );
+        _uploadFileButton.center = newCenter;
+        
+        // 重置偏移量,避免累加
+        [gesture setTranslation:CGPointZero inView:self.view];
+    }
+}
 
 #pragma mark - 懒加载
 - (UITableView *)tableView{

+ 22 - 0
创维盒子/code/Class/Set/previewFile/previewFileAndFolderSecondViewController.m

@@ -154,6 +154,10 @@
         make.bottom.mas_equalTo(-30 - AdaptTabHeight);
     }];
     
+    // 添加拖拽手势
+   UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
+   [_uploadFileButton addGestureRecognizer:panGesture];
+
 }
 
 - (void)initNavHeadUIFun
@@ -185,6 +189,24 @@
     
 }
 
+#pragma mark 处理拖拽手势
+- (void)handlePan:(UIPanGestureRecognizer *)gesture {
+    if (gesture.state == UIGestureRecognizerStateChanged) {
+        // 获取手指拖拽的偏移量
+        CGPoint translation = [gesture translationInView:self.view];
+        
+        // 更新视图位置
+        CGPoint newCenter = CGPointMake(
+            _uploadFileButton.center.x + translation.x,
+            _uploadFileButton.center.y + translation.y
+        );
+        _uploadFileButton.center = newCenter;
+        
+        // 重置偏移量,避免累加
+        [gesture setTranslation:CGPointZero inView:self.view];
+    }
+}
+
 
 #pragma mark - 懒加载
 - (UITableView *)tableView{

+ 21 - 0
创维盒子/code/Class/Set/previewFile/previewFileAndFolderViewController.m

@@ -170,6 +170,10 @@
         make.bottom.mas_equalTo(-30 - AdaptTabHeight);
     }];
     
+    // 添加拖拽手势
+   UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
+   [_uploadFileButton addGestureRecognizer:panGesture];
+    
     NSMutableArray *arr = [NSMutableArray new];
     NSArray *diskList = ksharedAppDelegate.cloudPhoneExtraFileListMod.data;
     if(diskList && [diskList isKindOfClass:[NSArray class]]){
@@ -274,6 +278,23 @@
     
 }
 
+#pragma mark 处理拖拽手势
+- (void)handlePan:(UIPanGestureRecognizer *)gesture {
+    if (gesture.state == UIGestureRecognizerStateChanged) {
+        // 获取手指拖拽的偏移量
+        CGPoint translation = [gesture translationInView:self.view];
+        
+        // 更新视图位置
+        CGPoint newCenter = CGPointMake(
+            _uploadFileButton.center.x + translation.x,
+            _uploadFileButton.center.y + translation.y
+        );
+        _uploadFileButton.center = newCenter;
+        
+        // 重置偏移量,避免累加
+        [gesture setTranslation:CGPointZero inView:self.view];
+    }
+}
 
 #pragma mark - 懒加载
 - (UITableView *)tableView{

+ 23 - 0
创维盒子/code/Class/Set/previewFile/previewImageOrVideoViewController.m

@@ -172,6 +172,11 @@
         make.bottom.mas_equalTo(-30 - AdaptTabHeight);
     }];
     
+    // 添加拖拽手势
+   UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
+   [_uploadFileButton addGestureRecognizer:panGesture];
+
+    
     NSMutableArray *arr = [NSMutableArray new];
     NSArray *diskList = ksharedAppDelegate.cloudPhoneExtraFileListMod.data;
     if(diskList && [diskList isKindOfClass:[NSArray class]]){
@@ -287,6 +292,24 @@
     
 }
 
+#pragma mark 处理拖拽手势
+- (void)handlePan:(UIPanGestureRecognizer *)gesture {
+    if (gesture.state == UIGestureRecognizerStateChanged) {
+        // 获取手指拖拽的偏移量
+        CGPoint translation = [gesture translationInView:self.view];
+        
+        // 更新视图位置
+        CGPoint newCenter = CGPointMake(
+            _uploadFileButton.center.x + translation.x,
+            _uploadFileButton.center.y + translation.y
+        );
+        _uploadFileButton.center = newCenter;
+        
+        // 重置偏移量,避免累加
+        [gesture setTranslation:CGPointZero inView:self.view];
+    }
+}
+
 
 #pragma mark - 懒加载
 - (UICollectionView *)dataCollectionView{

+ 22 - 0
创维盒子/code/NAS/NasPreviewVideoViewController.m

@@ -167,6 +167,11 @@
         make.bottom.mas_equalTo(-30 - AdaptTabHeight);
     }];
     
+    // 添加拖拽手势
+   UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
+   [_uploadFileButton addGestureRecognizer:panGesture];
+
+    
     NSMutableArray *arr = [NSMutableArray new];
     NSArray *diskList = ksharedAppDelegate.cloudPhoneExtraFileListMod.data;
     if(diskList && [diskList isKindOfClass:[NSArray class]]){
@@ -271,6 +276,23 @@
     
 }
 
+#pragma mark 处理拖拽手势
+- (void)handlePan:(UIPanGestureRecognizer *)gesture {
+    if (gesture.state == UIGestureRecognizerStateChanged) {
+        // 获取手指拖拽的偏移量
+        CGPoint translation = [gesture translationInView:self.view];
+        
+        // 更新视图位置
+        CGPoint newCenter = CGPointMake(
+            _uploadFileButton.center.x + translation.x,
+            _uploadFileButton.center.y + translation.y
+        );
+        _uploadFileButton.center = newCenter;
+        
+        // 重置偏移量,避免累加
+        [gesture setTranslation:CGPointZero inView:self.view];
+    }
+}
 
 #pragma mark - 懒加载
 - (UITableView *)tableView{