Parcourir la source

1.修改图片预览索引不正确。

Pen Li il y a 7 ans
Parent
commit
e74ee134a5
1 fichiers modifiés avec 11 ajouts et 7 suppressions
  1. 11 7
      common/InfinitePhoto/Controller/RAPhotoPreviewController.m

+ 11 - 7
common/InfinitePhoto/Controller/RAPhotoPreviewController.m

@@ -201,13 +201,17 @@
 #pragma mark - Private
 
 - (void)updateIndicator {
-    
-    NSUInteger index = 0;
-    if (self.currentIndex < self.offset) {
-        index = (unsigned long)self.currentIndex + 1 + self.offset;
-    } else {
-        index = (unsigned long)self.currentIndex + 1 - self.offset;
-    }
+
+    /**
+     
+            x
+
+    0 1 2 3 4 5 6 7 8 9
+
+    4 5 6 7 8 9 0 1 2 3
+     
+     */
+    NSUInteger index = (self.currentIndex + self.offset) % self.photos.count + 1;
     NSString *offset = [NSString stringWithFormat:@"%lu / %lu",index,(unsigned long)self.photos.count];
     self.indicator.text = offset;
 }