瀏覽代碼

上传视频,点一个视频放大后点右上角选中,再点左上角返回,选中的视频变成上一个了

huangxiaodong 1 年之前
父節點
當前提交
bdec7a6bff

+ 8 - 6
创维盒子/双子星云手机/Class/Set/uploadFile/PhotoPreviewViewController.m

@@ -126,14 +126,15 @@
                     if ([asset isKindOfClass:[AVURLAsset class]]) {
                         
                         AVURLAsset* urlAsset = (AVURLAsset*)asset;
-                        NSData *videoData = [NSData dataWithContentsOfURL:urlAsset.URL];
-//                        NSNumber *size;
-//                        [urlAsset.URL getResourceValue:&size forKey:NSURLFileSizeKey error:nil];
-//                        NSLog(@"size is %f",[size floatValue]/(1024.0*1024.0));
+                        //NSData *videoData = [NSData dataWithContentsOfURL:urlAsset.URL];
+                        NSNumber *size;
+                        [urlAsset.URL getResourceValue:&size forKey:NSURLFileSizeKey error:nil];
+                        //NSLog(@"size is %f",[size floatValue]/(1024.0*1024.0));
                      
                         
                         //model.videoData = videoData;
-                        model.totalBytes = [videoData length];
+                        //model.totalBytes = [videoData length];
+                        model.totalBytes = size.longLongValue;
                         [self setDataToBottomViewFun];
                  }
                 }];
@@ -301,7 +302,8 @@
     CGFloat offSetWidth = scrollView.contentOffset.x;
     offSetWidth = offSetWidth +  (SCREEN_W * 0.5);
     
-    NSInteger currentIndex = offSetWidth / (SCREEN_W + 20);
+    //NSInteger currentIndex = offSetWidth / (SCREEN_W + 20);
+    NSInteger currentIndex = offSetWidth / (SCREEN_W);
     if (currentIndex < _assets.count && _currentIndex != currentIndex && _canSetCurrentIndex)
     {
         _currentIndex = currentIndex;

+ 2 - 1
创维盒子/双子星云手机/Class/Set/uploadFile/uploadImageOrVideoViewController.m

@@ -449,9 +449,10 @@
 }
 
 - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
+    NSInteger curRow = indexPath.row;
     PhotoPreviewViewController *vc =[PhotoPreviewViewController new];
     vc.assets = _assets;
-    vc.currentIndex = indexPath.row;
+    vc.currentIndex = curRow;
     vc.indexPathsForSelectedItems = _indexPathsForSelectedItems;
     //vc.maximumNumberOfSelection = _maximumNumberOfSelection;
     vc.minimumNumberOfSelection = _minimumNumberOfSelection;