소스 검색

20170215

Fix NPD Mobile Home page slideview cpu high usage.
Ray Zhang 9 년 전
부모
커밋
528147e804
1개의 변경된 파일10개의 추가작업 그리고 2개의 파일을 삭제
  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)];
     }
 }