From a49fe53249a9ea9e183ecfa77286631908c6e044 Mon Sep 17 00:00:00 2001 From: Mauricio Cousillas Date: Mon, 21 Sep 2015 14:26:47 -0300 Subject: [PATCH] bug fix TwitterPager pageControl position --- .../XLTwitterPagerTabStripViewController.m | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/XLPagerTabStrip/XL/Controllers/XLTwitterPagerTabStripViewController.m b/XLPagerTabStrip/XL/Controllers/XLTwitterPagerTabStripViewController.m index 2d950a1..aab8ed1 100644 --- a/XLPagerTabStrip/XL/Controllers/XLTwitterPagerTabStripViewController.m +++ b/XLPagerTabStrip/XL/Controllers/XLTwitterPagerTabStripViewController.m @@ -60,13 +60,6 @@ [self reloadNavigationViewItems]; } --(void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; - [self setNavigationViewItemsPosition]; -} - - -(void)reloadPagerTabStripView { [super reloadPagerTabStripView]; @@ -209,6 +202,11 @@ } -(void)setNavigationViewItemsPosition +{ + [self setNavigationViewItemsPosition:YES]; +} + +-(void)setNavigationViewItemsPosition:(BOOL)updateAlpha { CGFloat distance = [self getDistanceValue]; BOOL isPortrait = UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation); @@ -216,7 +214,9 @@ [self.navigationItemsViews enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { int index = (int)idx; UILabel *label = (UILabel *)obj; - [label setAlpha:self.currentIndex == idx ? 1 : 0]; + if (updateAlpha){ + [label setAlpha:self.currentIndex == idx ? 1 : 0]; + } label.font = isPortrait ? self.portraitTitleFont : self.landscapeTitleFont; CGSize viewSize = [self getLabelSize:label]; CGFloat originX = (distance - viewSize.width/2) + index * distance; @@ -282,4 +282,10 @@ return _portraitTitleFont; } +-(void)viewDidLayoutSubviews +{ + [super viewDidLayoutSubviews]; + [self setNavigationViewItemsPosition:NO]; +} + @end