@@ -141,6 +141,7 @@ @interface ViewPagerController () <UIPageViewControllerDataSource, UIPageViewCon
141141@property (nonatomic ) NSUInteger activeContentIndex;
142142
143143@property (getter = isAnimatingToTab, assign ) BOOL animatingToTab;
144+ @property (getter = isShouldClicked, assign ) BOOL shouldClicked;
144145@property (getter = isDefaultSetupDone, assign ) BOOL defaultSetupDone;
145146
146147// Colors
@@ -233,6 +234,8 @@ - (IBAction)handleTapGesture:(id)sender {
233234 UIView *tabView = tapGestureRecognizer.view ;
234235 __block NSUInteger index = [self .tabs indexOfObject: tabView];
235236
237+ self.shouldClicked = YES ;
238+
236239 // if Tap is not selected Tab(new Tab)
237240 if (self.activeTabIndex != index) {
238241 // Select the tab
@@ -386,6 +389,7 @@ - (void)setActiveContentIndex:(NSUInteger)activeContentIndex {
386389 animated: YES
387390 completion: ^(BOOL completed) {
388391
392+ weakSelf.shouldClicked = NO ;
389393 weakSelf.animatingToTab = NO ;
390394
391395 // Set the current page again to obtain synchronisation between tabs and content
@@ -403,6 +407,7 @@ - (void)setActiveContentIndex:(NSUInteger)activeContentIndex {
403407 direction: (activeContentIndex < self .activeContentIndex) ? UIPageViewControllerNavigationDirectionReverse : UIPageViewControllerNavigationDirectionForward
404408 animated: YES
405409 completion: ^(BOOL completed) {
410+ weakSelf.shouldClicked = NO ;
406411 weakSelf.animatingToTab = NO ;
407412 }];
408413 }
@@ -579,7 +584,7 @@ - (void)selectTabAtIndex:(NSUInteger)index {
579584 return ;
580585 }
581586
582- self.animatingToTab = YES ;
587+ self.animatingToTab = NO ;
583588
584589 // Set activeTabIndex
585590 self.activeTabIndex = index;
@@ -758,6 +763,7 @@ - (void)defaultSettings {
758763 self.pageViewController .delegate = self;
759764
760765 self.animatingToTab = NO ;
766+ self.shouldClicked = NO ;
761767 self.defaultSetupDone = NO ;
762768}
763769- (void )defaultSetup {
@@ -965,7 +971,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
965971 [self .actualDelegate scrollViewDidScroll: scrollView];
966972 }
967973
968- if (![self isAnimatingToTab ]) {
974+ if (![self isAnimatingToTab ] && !self. shouldClicked ) {
969975 UIView *tabView = [self tabViewAtIndex: self .activeTabIndex];
970976
971977 // Get the related tab view position
0 commit comments