Explorar el Código

1.修改NPD Model Detail图片预览,初始化增加Mask,掩藏滚动。

Pen Li hace 8 años
padre
commit
8f1185398c

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 23 - 10
RedAnt ERP Mobile/iSales-NPD/PhotoList/Controller/ContentPreviewController.m

@@ -54,6 +54,7 @@
     self.previewContainer.pagingEnabled = YES;
     NSString *offset = [NSString stringWithFormat:@"%lu / %lu",(unsigned long)self.currentIndex + 1,(unsigned long)self.photos.count];
     self.indicator.text = offset;
+   
     
     
     self.hideNavigationBar = self.navigationController.isNavigationBarHidden;
@@ -61,7 +62,11 @@
     self.navigationController.navigationBarHidden = YES;
     
     // 掩藏滚动
-//    [self.view insertSubview:self.mask belowSubview:self.indicator];
+    [self.view insertSubview:self.mask belowSubview:self.indicator];
+}
+
+- (void)viewWillAppear:(BOOL)animated {
+    [super viewWillAppear:animated];
 }
 
 - (void)viewDidLayoutSubviews {
@@ -72,7 +77,9 @@
 //        [self.previewContainer scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:self.currentIndex inSection:0] atScrollPosition:16 animated:YES];
 //    }
     
-    [self scrollToIndex:self.currentIndex + 1];
+//    [self scrollToIndex:self.currentIndex + 1];
+   [self.previewContainer setContentOffset:CGPointMake((self.currentIndex + 1) * CGRectGetWidth(self.previewContainer.frame), 0) animated:YES];
+
 }
 
 - (void)viewDidAppear:(BOOL)animated {
@@ -80,14 +87,15 @@
     
 //    [self.previewContainer scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:self.currentIndex inSection:0] atScrollPosition:16 animated:YES];
     
-//    dispatch_async(dispatch_get_global_queue(0, 0), ^{
-//        sleep(0.25);
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [self.mask removeFromSuperview];
-//            self.mask = nil;
-//        });
-//
-//    });
+    __weak typeof(self) weakself = self;
+    dispatch_async(dispatch_get_global_queue(0, 0), ^{
+        sleep(0.25);
+        dispatch_async(dispatch_get_main_queue(), ^{
+            [weakself.mask removeFromSuperview];
+            weakself.mask = nil;
+        });
+
+    });
 }
 
 - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
@@ -272,6 +280,11 @@
 //            self.indicator(self.currentIndex, self.photos.count);
 //        }
         [self updateIndicator];
+    } else {
+//        idxi = ceil(idxf);
+//        if (idxi != 0 || idxi != self.photos.count + 1) {
+//            [self scrollToIndex:idxi];
+//        }
     }
     
     if (idxi == 0) {