Browse Source

20170215

Fix NPD Mobile Home page slideview cpu high usage.
Ray Zhang 9 năm trước cách đây
mục cha
commit
528147e804
1 tập tin đã thay đổi với 10 bổ sung2 xóa
  1. 10 2
      RedAnt ERP Mobile/common/AutoScrollImage/CycleScrollView.m

+ 10 - 2
RedAnt ERP Mobile/common/AutoScrollImage/CycleScrollView.m

@@ -132,8 +132,9 @@
     NSInteger counter = 0;
     for (UIView *contentView in self.contentViews) {
         contentView.userInteractionEnabled = YES;
-        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(contentViewTapAction:)];
-        [contentView addGestureRecognizer:tapGesture];
+        
+        NSLog(@"contentView gesture count %d",contentView.gestureRecognizers.count);
+
         CGRect rightRect = contentView.frame;
         rightRect.origin = CGPointMake(CGRectGetWidth(self.scrollView.frame) * (counter ++), 0);
         
@@ -158,6 +159,13 @@
     if (self.fetchContentViewAtIndex) {
         [self.contentViews addObject:self.fetchContentViewAtIndex(previousPageIndex)];
         [self.contentViews addObject:self.fetchContentViewAtIndex(_currentPageIndex)];
+        
+        
+        UIView* currentView =self.fetchContentViewAtIndex(_currentPageIndex);
+        currentView.gestureRecognizers= nil;
+        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(contentViewTapAction:)];
+        [self.fetchContentViewAtIndex(_currentPageIndex) addGestureRecognizer:tapGesture];
+        
         [self.contentViews addObject:self.fetchContentViewAtIndex(rearPageIndex)];
     }
 }