From d6cc5c1315ee7cb24a19ea8ba1622dd681b03911 Mon Sep 17 00:00:00 2001 From: FrankWu100 Date: Tue, 4 Feb 2014 21:26:28 +0800 Subject: [PATCH 01/10] Update & Fix issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update Storyboard to Xcode 5 & iOS7 Fix if iOS 7 Navigation Bar type is Translucent, don’t need to set topLayoutGuide. --- ICViewPager/ICViewPager/ViewPagerController.m | 2 +- ICViewPager/iPhone.storyboard | 26 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ICViewPager/ICViewPager/ViewPagerController.m b/ICViewPager/ICViewPager/ViewPagerController.m index 4281853..4ddc5e3 100644 --- a/ICViewPager/ICViewPager/ViewPagerController.m +++ b/ICViewPager/ICViewPager/ViewPagerController.m @@ -203,7 +203,7 @@ - (void)didReceiveMemoryWarning { - (void)layoutSubviews { CGFloat topLayoutGuide = 0.0; - if (IOS_VERSION_7) { + if (IOS_VERSION_7 && self.navigationController.navigationBar.translucent) { topLayoutGuide = 20.0; if (self.navigationController && !self.navigationController.navigationBarHidden) { topLayoutGuide += self.navigationController.navigationBar.frame.size.height; diff --git a/ICViewPager/iPhone.storyboard b/ICViewPager/iPhone.storyboard index e35b3ad..51e5ca7 100644 --- a/ICViewPager/iPhone.storyboard +++ b/ICViewPager/iPhone.storyboard @@ -1,17 +1,21 @@ - + - - - + + + + + + + - + @@ -25,8 +29,12 @@ + + + + - + - - - + + + From 60e293160a8474954f8dab426f52264dda48e8de Mon Sep 17 00:00:00 2001 From: FrankWu100 Date: Sat, 8 Feb 2014 15:31:14 +0800 Subject: [PATCH 02/10] Amend Previous Commit Fix if iOS 7 Navigation Bar type is Opaque not Translucent set topLayoutGuide = 0.0. --- ICViewPager/ICViewPager/ViewPagerController.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ICViewPager/ICViewPager/ViewPagerController.m b/ICViewPager/ICViewPager/ViewPagerController.m index 4ddc5e3..1b5442e 100644 --- a/ICViewPager/ICViewPager/ViewPagerController.m +++ b/ICViewPager/ICViewPager/ViewPagerController.m @@ -203,10 +203,15 @@ - (void)didReceiveMemoryWarning { - (void)layoutSubviews { CGFloat topLayoutGuide = 0.0; - if (IOS_VERSION_7 && self.navigationController.navigationBar.translucent) { + if (IOS_VERSION_7) { topLayoutGuide = 20.0; if (self.navigationController && !self.navigationController.navigationBarHidden) { - topLayoutGuide += self.navigationController.navigationBar.frame.size.height; + if (self.navigationController.navigationBar.translucent) { + topLayoutGuide += self.navigationController.navigationBar.frame.size.height; + } + else if (self.navigationController.navigationBar.opaque) { + topLayoutGuide = 0.0; + } } } From d8c89c31a38f5398179764b6f448cd4735355810 Mon Sep 17 00:00:00 2001 From: Frank Wu Date: Tue, 19 Jul 2016 13:08:39 +0800 Subject: [PATCH 03/10] Add tab's line control --- ICViewPager/ICViewPager/ViewPagerController.h | 4 + ICViewPager/ICViewPager/ViewPagerController.m | 116 +++++++++++++++++- 2 files changed, 115 insertions(+), 5 deletions(-) diff --git a/ICViewPager/ICViewPager/ViewPagerController.h b/ICViewPager/ICViewPager/ViewPagerController.h index 6652bfd..8cc0123 100644 --- a/ICViewPager/ICViewPager/ViewPagerController.h +++ b/ICViewPager/ICViewPager/ViewPagerController.h @@ -25,6 +25,10 @@ typedef NS_ENUM(NSUInteger, ViewPagerOption) { ViewPagerOptionTabOffset, ViewPagerOptionTabWidth, ViewPagerOptionTabLocation, + ViewPagerOptionTabNarmalLineWidth, + ViewPagerOptionTabSelectedLineWidth, + ViewPagerOptionTabDisableTopLine, + ViewPagerOptionTabDisableBottomLine, ViewPagerOptionStartFromSecondTab, ViewPagerOptionCenterCurrentTab, ViewPagerOptionFixFormerTabsPositions, diff --git a/ICViewPager/ICViewPager/ViewPagerController.m b/ICViewPager/ICViewPager/ViewPagerController.m index 1b5442e..b7353d7 100644 --- a/ICViewPager/ICViewPager/ViewPagerController.m +++ b/ICViewPager/ICViewPager/ViewPagerController.m @@ -17,6 +17,10 @@ #define kTabOffset 56.0 #define kTabWidth 128.0 #define kTabLocation 1.0 +#define kTabNarmalLineWidth 1.0 +#define kTabSelectedLineWidth 5.0 +#define kTabDisableTopLine 0.0 +#define kTabDisableBottomLine 0.0 #define kStartFromSecondTab 0.0 #define kCenterCurrentTab 0.0 #define kFixFormerTabsPositions 0.0 @@ -62,6 +66,10 @@ - (BOOL)isEqualToColor:(UIColor *)otherColor { @interface TabView : UIView @property (nonatomic, getter = isSelected) BOOL selected; @property (nonatomic) UIColor *indicatorColor; +@property (nonatomic) BOOL disableTopLine; +@property (nonatomic) BOOL disableBottomLine; +@property (nonatomic) CGFloat narmalLineWidth; +@property (nonatomic) CGFloat selectedLineWidth; @end @implementation TabView @@ -69,6 +77,8 @@ - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor clearColor]; + self.narmalLineWidth = 1.0; + self.selectedLineWidth = 5.0; } return self; } @@ -86,7 +96,7 @@ - (void)drawRect:(CGRect)rect { [bezierPath moveToPoint:CGPointMake(0.0, 0.0)]; [bezierPath addLineToPoint:CGPointMake(CGRectGetWidth(rect), 0.0)]; [[UIColor colorWithWhite:197.0/255.0 alpha:0.75] setStroke]; - [bezierPath setLineWidth:1.0]; + [bezierPath setLineWidth:(self.disableTopLine ? 0.0 : self.narmalLineWidth)]; [bezierPath stroke]; // Draw bottom line @@ -94,7 +104,7 @@ - (void)drawRect:(CGRect)rect { [bezierPath moveToPoint:CGPointMake(0.0, CGRectGetHeight(rect))]; [bezierPath addLineToPoint:CGPointMake(CGRectGetWidth(rect), CGRectGetHeight(rect))]; [[UIColor colorWithWhite:197.0/255.0 alpha:0.75] setStroke]; - [bezierPath setLineWidth:1.0]; + [bezierPath setLineWidth:(self.disableBottomLine ? 0.0 : self.narmalLineWidth)]; [bezierPath stroke]; // Draw an indicator line if tab is selected @@ -105,7 +115,7 @@ - (void)drawRect:(CGRect)rect { // Draw the indicator [bezierPath moveToPoint:CGPointMake(0.0, CGRectGetHeight(rect) - 1.0)]; [bezierPath addLineToPoint:CGPointMake(CGRectGetWidth(rect), CGRectGetHeight(rect) - 1.0)]; - [bezierPath setLineWidth:5.0]; + [bezierPath setLineWidth:self.selectedLineWidth]; [self.indicatorColor setStroke]; [bezierPath stroke]; } @@ -131,6 +141,10 @@ @interface ViewPagerController () 1.0) + tabNarmalLineWidth = [NSNumber numberWithFloat:1.0]; + else if ([tabNarmalLineWidth floatValue] < 0.0) + tabNarmalLineWidth = [NSNumber numberWithFloat:0.0]; + + _tabNarmalLineWidth = tabNarmalLineWidth; +} +- (void)setTabSelectedLineWidth:(NSNumber *)tabSelectedLineWidth { + + if ([tabSelectedLineWidth floatValue] > 1.0) + tabSelectedLineWidth = [NSNumber numberWithFloat:1.0]; + else if ([tabSelectedLineWidth floatValue] < 0.0) + tabSelectedLineWidth = [NSNumber numberWithFloat:0.0]; + + _tabSelectedLineWidth = tabSelectedLineWidth; +} +- (void)setTabDisableTopLine:(NSNumber *)tabDisableTopLine { + + if ([tabDisableTopLine floatValue] != 1.0 && [tabDisableTopLine floatValue] != 0.0) + tabDisableTopLine = [tabDisableTopLine boolValue] ? [NSNumber numberWithBool:YES] : [NSNumber numberWithBool:NO]; + + _tabDisableTopLine = tabDisableTopLine; +} +-(void)setTabDisableBottomLine:(NSNumber *)tabDisableBottomLine { + + if ([tabDisableBottomLine floatValue] != 1.0 && [tabDisableBottomLine floatValue] != 0.0) + tabDisableBottomLine = [tabDisableBottomLine boolValue] ? [NSNumber numberWithBool:YES] : [NSNumber numberWithBool:NO]; + + _tabDisableBottomLine = tabDisableBottomLine; +} - (void)setStartFromSecondTab:(NSNumber *)startFromSecondTab { if ([startFromSecondTab floatValue] != 1.0 && [startFromSecondTab floatValue] != 0.0) @@ -480,6 +530,46 @@ - (NSNumber *)tabLocation { } return _tabLocation; } +- (NSNumber *)tabNarmalLineWidth { + + if (!_tabNarmalLineWidth) { + CGFloat value = kTabNarmalLineWidth; + if ([self.delegate respondsToSelector:@selector(viewPager:valueForOption:withDefault:)]) + value = [self.delegate viewPager:self valueForOption:ViewPagerOptionTabNarmalLineWidth withDefault:value]; + self.tabNarmalLineWidth = [NSNumber numberWithFloat:value]; + } + return _tabNarmalLineWidth; +} +- (NSNumber *)tabSelectedLineWidth { + + if (!_tabSelectedLineWidth) { + CGFloat value = kTabSelectedLineWidth; + if ([self.delegate respondsToSelector:@selector(viewPager:valueForOption:withDefault:)]) + value = [self.delegate viewPager:self valueForOption:ViewPagerOptionTabSelectedLineWidth withDefault:value]; + self.tabSelectedLineWidth = [NSNumber numberWithFloat:value]; + } + return _tabSelectedLineWidth; +} +- (NSNumber *)tabDisableTopLine { + + if (!_tabDisableTopLine) { + CGFloat value = kTabDisableTopLine; + if ([self.delegate respondsToSelector:@selector(viewPager:valueForOption:withDefault:)]) + value = [self.delegate viewPager:self valueForOption:ViewPagerOptionTabDisableTopLine withDefault:value]; + self.tabDisableTopLine = [NSNumber numberWithFloat:value]; + } + return _tabDisableTopLine; +} +- (NSNumber *)tabDisableBottomLine { + + if (!_tabDisableBottomLine) { + CGFloat value = kTabDisableBottomLine; + if ([self.delegate respondsToSelector:@selector(viewPager:valueForOption:withDefault:)]) + value = [self.delegate viewPager:self valueForOption:ViewPagerOptionTabDisableBottomLine withDefault:value]; + self.tabDisableBottomLine = [NSNumber numberWithFloat:value]; + } + return _tabDisableBottomLine; +} - (NSNumber *)startFromSecondTab { if (!_startFromSecondTab) { @@ -565,6 +655,10 @@ - (void)reloadData { _tabOffset = nil; _tabWidth = nil; _tabLocation = nil; + _tabNarmalLineWidth = nil; + _tabSelectedLineWidth = nil; + _tabDisableTopLine = nil; + _tabDisableBottomLine = nil; _startFromSecondTab = nil; _centerCurrentTab = nil; _fixFormerTabsPositions = nil; @@ -722,6 +816,14 @@ - (CGFloat)valueForOption:(ViewPagerOption)option { return [[self tabWidth] floatValue]; case ViewPagerOptionTabLocation: return [[self tabLocation] floatValue]; + case ViewPagerOptionTabNarmalLineWidth: + return [[self tabNarmalLineWidth] floatValue]; + case ViewPagerOptionTabSelectedLineWidth: + return [[self tabSelectedLineWidth] floatValue]; + case ViewPagerOptionTabDisableTopLine: + return [[self tabDisableTopLine] floatValue]; + case ViewPagerOptionTabDisableBottomLine: + return [[self tabDisableBottomLine] floatValue]; case ViewPagerOptionStartFromSecondTab: return [[self startFromSecondTab] floatValue]; case ViewPagerOptionCenterCurrentTab: @@ -752,7 +854,7 @@ - (void)defaultSettings { navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil]; [self addChildViewController:self.pageViewController]; - + // Setup some forwarding events to hijack the scrollView // Keep a reference to the actual delegate self.actualDelegate = ((UIScrollView *)[self.pageViewController.view.subviews objectAtIndex:0]).delegate; @@ -880,7 +982,7 @@ - (TabView *)tabViewAtIndex:(NSUInteger)index { } if ([[self.tabs objectAtIndex:index] isEqual:[NSNull null]]) { - + // Get view from dataSource UIView *tabViewContent = [self.dataSource viewPager:self viewForTabAtIndex:index]; tabViewContent.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; @@ -890,6 +992,10 @@ - (TabView *)tabViewAtIndex:(NSUInteger)index { [tabView addSubview:tabViewContent]; [tabView setClipsToBounds:YES]; [tabView setIndicatorColor:self.indicatorColor]; + [tabView setNarmalLineWidth:[self.tabNarmalLineWidth floatValue]]; + [tabView setSelectedLineWidth:[self.tabSelectedLineWidth floatValue]]; + [tabView setDisableTopLine:[self.tabDisableTopLine boolValue]]; + [tabView setDisableBottomLine:[self.tabDisableBottomLine boolValue]]; tabViewContent.center = tabView.center; From 795528b65cdaec0720195828e428db29302933a3 Mon Sep 17 00:00:00 2001 From: Frank Wu Date: Tue, 19 Jul 2016 13:14:45 +0800 Subject: [PATCH 04/10] podspec up to 1.5.2 --- ICViewPager.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ICViewPager.podspec b/ICViewPager.podspec index 3d96184..bcb54f4 100644 --- a/ICViewPager.podspec +++ b/ICViewPager.podspec @@ -32,7 +32,7 @@ Pod::Spec.new do |s| s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { "Ilter Cengiz" => "me@iltercengiz.info" } s.platform = :ios, '6.0' - s.source = { :git => "https://github.com/monsieurje/ICViewPager.git", :tag => "1.5.1" } + s.source = { :git => "https://github.com/monsieurje/ICViewPager.git", :tag => "1.5.2" } s.source_files = 'ICViewPager/ICViewPager/*.{h,m}' s.requires_arc = true From c9551c113b5eab725036f6f50a5c6256a5571667 Mon Sep 17 00:00:00 2001 From: Frank Wu Date: Tue, 19 Jul 2016 13:29:27 +0800 Subject: [PATCH 05/10] fix tabSelectedLineWidth not work --- ICViewPager/ICViewPager/ViewPagerController.m | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ICViewPager/ICViewPager/ViewPagerController.m b/ICViewPager/ICViewPager/ViewPagerController.m index b7353d7..a7cd13f 100644 --- a/ICViewPager/ICViewPager/ViewPagerController.m +++ b/ICViewPager/ICViewPager/ViewPagerController.m @@ -310,18 +310,14 @@ - (void)setTabLocation:(NSNumber *)tabLocation { } - (void)setTabNarmalLineWidth:(NSNumber *)tabNarmalLineWidth { - if ([tabNarmalLineWidth floatValue] > 1.0) - tabNarmalLineWidth = [NSNumber numberWithFloat:1.0]; - else if ([tabNarmalLineWidth floatValue] < 0.0) + if ([tabNarmalLineWidth floatValue] < 0.0) tabNarmalLineWidth = [NSNumber numberWithFloat:0.0]; _tabNarmalLineWidth = tabNarmalLineWidth; } - (void)setTabSelectedLineWidth:(NSNumber *)tabSelectedLineWidth { - if ([tabSelectedLineWidth floatValue] > 1.0) - tabSelectedLineWidth = [NSNumber numberWithFloat:1.0]; - else if ([tabSelectedLineWidth floatValue] < 0.0) + if ([tabSelectedLineWidth floatValue] < 0.0) tabSelectedLineWidth = [NSNumber numberWithFloat:0.0]; _tabSelectedLineWidth = tabSelectedLineWidth; From 8c6f30faa4e76ed172bf2e053124ec100e33a521 Mon Sep 17 00:00:00 2001 From: Frank Wu Date: Tue, 19 Jul 2016 13:30:19 +0800 Subject: [PATCH 06/10] podspec up to 1.5.3 --- ICViewPager.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ICViewPager.podspec b/ICViewPager.podspec index bcb54f4..e8b695c 100644 --- a/ICViewPager.podspec +++ b/ICViewPager.podspec @@ -32,7 +32,7 @@ Pod::Spec.new do |s| s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { "Ilter Cengiz" => "me@iltercengiz.info" } s.platform = :ios, '6.0' - s.source = { :git => "https://github.com/monsieurje/ICViewPager.git", :tag => "1.5.2" } + s.source = { :git => "https://github.com/monsieurje/ICViewPager.git", :tag => "1.5.3" } s.source_files = 'ICViewPager/ICViewPager/*.{h,m}' s.requires_arc = true From 408f873c53707573a72387273d6c361cc5300f53 Mon Sep 17 00:00:00 2001 From: Frank Wu Date: Fri, 19 Aug 2016 18:59:00 +0800 Subject: [PATCH 07/10] freshen topLayoutGuide counting code --- ICViewPager/ICViewPager/ViewPagerController.m | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/ICViewPager/ICViewPager/ViewPagerController.m b/ICViewPager/ICViewPager/ViewPagerController.m index a7cd13f..96a1e64 100644 --- a/ICViewPager/ICViewPager/ViewPagerController.m +++ b/ICViewPager/ICViewPager/ViewPagerController.m @@ -222,14 +222,9 @@ - (void)layoutSubviews { CGFloat topLayoutGuide = 0.0; if (IOS_VERSION_7) { - topLayoutGuide = 20.0; - if (self.navigationController && !self.navigationController.navigationBarHidden) { - if (self.navigationController.navigationBar.translucent) { - topLayoutGuide += self.navigationController.navigationBar.frame.size.height; - } - else if (self.navigationController.navigationBar.opaque) { - topLayoutGuide = 0.0; - } + if (self.navigationController.navigationBar.translucent) { + if (self.prefersStatusBarHidden == NO) topLayoutGuide += 20; + if (self.navigationController.navigationBarHidden == NO) topLayoutGuide += self.navigationController.navigationBar.bounds.size.height; } } From bdafff5f2090df73ae911a4ccfdec42062716405 Mon Sep 17 00:00:00 2001 From: Frank Wu Date: Fri, 19 Aug 2016 19:00:03 +0800 Subject: [PATCH 08/10] Merge remote-tracking branch 'iltercengiz/master' --- ICViewPager/ICViewPager/ViewPagerController.h | 17 ++++++++++++++ ICViewPager/ICViewPager/ViewPagerController.m | 22 +++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/ICViewPager/ICViewPager/ViewPagerController.h b/ICViewPager/ICViewPager/ViewPagerController.h index 8cc0123..8af632d 100644 --- a/ICViewPager/ICViewPager/ViewPagerController.h +++ b/ICViewPager/ICViewPager/ViewPagerController.h @@ -172,6 +172,23 @@ typedef NS_ENUM(NSUInteger, ViewPagerComponent) { * @param index The index of the active tab */ - (void)viewPager:(ViewPagerController *)viewPager didChangeTabToIndex:(NSUInteger)index; +/** + * delegate object should implement this method if it wants to be informed when a tab changes and what its previous tab index was + * + * @param viewPager The viewPager that's subject to + * @param index The index of the active tab + * @param previousIndex The previous index of the active tab + */ +- (void)viewPager:(ViewPagerController *)viewPager didChangeTabToIndex:(NSUInteger)index fromIndex:(NSUInteger)previousIndex; +/** + * delegate object should implement this method if it wants to be informed when a tab changes and what its previous tab index was and whether the change action was caused by a swipe gesture or tab bar button press + * + * @param viewPager The viewPager that's subject to + * @param index The index of the active tab + * @param previousIndex The previous index of the active tab + * @param didSwipe Indicating if the change action was caused by a swipe gesture or a tab bar button press + */ +- (void)viewPager:(ViewPagerController *)viewPager didChangeTabToIndex:(NSUInteger)index fromIndex:(NSUInteger)previousIndex didSwipe:(BOOL)didSwipe; /** * Every time -reloadData method called, ViewPager will ask its delegate for option values. * So you don't have to set options from ViewPager itself. diff --git a/ICViewPager/ICViewPager/ViewPagerController.m b/ICViewPager/ICViewPager/ViewPagerController.m index 96a1e64..9a2b781 100644 --- a/ICViewPager/ICViewPager/ViewPagerController.m +++ b/ICViewPager/ICViewPager/ViewPagerController.m @@ -239,7 +239,7 @@ - (void)layoutSubviews { frame.origin.x = 0.0; frame.origin.y = [self.tabLocation boolValue] ? topLayoutGuide + CGRectGetHeight(self.tabsView.frame) : topLayoutGuide; frame.size.width = CGRectGetWidth(self.view.frame); - frame.size.height = CGRectGetHeight(self.view.frame) - (topLayoutGuide + CGRectGetHeight(self.tabsView.frame)) - CGRectGetHeight(self.tabBarController.tabBar.frame); + frame.size.height = CGRectGetHeight(self.view.frame) - (topLayoutGuide + CGRectGetHeight(self.tabsView.frame)) - (self.tabBarController.tabBar.hidden ? 0 : CGRectGetHeight(self.tabBarController.tabBar.frame)); self.contentView.frame = frame; } @@ -254,7 +254,7 @@ - (IBAction)handleTapGesture:(id)sender { //if Tap is not selected Tab(new Tab) if (self.activeTabIndex != index) { // Select the tab - [self selectTabAtIndex:index]; + [self selectTabAtIndex:index didSwipe:NO]; } } @@ -663,7 +663,12 @@ - (void)reloadData { // Call to setup again with the updated data [self defaultSetup]; } + - (void)selectTabAtIndex:(NSUInteger)index { + [self selectTabAtIndex:index didSwipe:NO]; +} + +- (void)selectTabAtIndex:(NSUInteger)index didSwipe:(BOOL)didSwipe { if (index >= self.tabCount) { return; @@ -671,6 +676,9 @@ - (void)selectTabAtIndex:(NSUInteger)index { self.animatingToTab = YES; + // Keep a reference to previousIndex in case it is needed for the delegate + NSUInteger previousIndex = self.activeTabIndex; + // Set activeTabIndex self.activeTabIndex = index; @@ -681,6 +689,12 @@ - (void)selectTabAtIndex:(NSUInteger)index { if ([self.delegate respondsToSelector:@selector(viewPager:didChangeTabToIndex:)]) { [self.delegate viewPager:self didChangeTabToIndex:self.activeTabIndex]; } + else if([self.delegate respondsToSelector:@selector(viewPager:didChangeTabToIndex:fromIndex:)]){ + [self.delegate viewPager:self didChangeTabToIndex:self.activeTabIndex fromIndex:previousIndex]; + } + else if ([self.delegate respondsToSelector:@selector(viewPager:didChangeTabToIndex:fromIndex:didSwipe:)]) { + [self.delegate viewPager:self didChangeTabToIndex:self.activeTabIndex fromIndex:previousIndex didSwipe:didSwipe]; + } } - (void)setNeedsReloadOptions { @@ -960,7 +974,7 @@ - (void)defaultSetup { // Select starting tab NSUInteger index = [self.startFromSecondTab boolValue] ? 1 : 0; - [self selectTabAtIndex:index]; + [self selectTabAtIndex:index didSwipe:NO]; // Set setup done self.defaultSetupDone = YES; @@ -1057,7 +1071,7 @@ - (void)pageViewController:(UIPageViewController *)pageViewController didFinishA // Select tab NSUInteger index = [self indexForViewController:viewController]; - [self selectTabAtIndex:index]; + [self selectTabAtIndex:index didSwipe:YES]; } #pragma mark - UIScrollViewDelegate, Responding to Scrolling and Dragging From 7f4f7991839ff75406f95978b6bb9e45562d78ae Mon Sep 17 00:00:00 2001 From: Frank Wu Date: Fri, 9 Aug 2019 01:16:25 +0800 Subject: [PATCH 09/10] update to support more iOS screen size. --- ICViewPager/ICViewPager/ViewPagerController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ICViewPager/ICViewPager/ViewPagerController.m b/ICViewPager/ICViewPager/ViewPagerController.m index 9a2b781..d06b717 100644 --- a/ICViewPager/ICViewPager/ViewPagerController.m +++ b/ICViewPager/ICViewPager/ViewPagerController.m @@ -223,7 +223,7 @@ - (void)layoutSubviews { CGFloat topLayoutGuide = 0.0; if (IOS_VERSION_7) { if (self.navigationController.navigationBar.translucent) { - if (self.prefersStatusBarHidden == NO) topLayoutGuide += 20; + if (self.prefersStatusBarHidden == NO) topLayoutGuide += [UIApplication sharedApplication].statusBarFrame.size.height; if (self.navigationController.navigationBarHidden == NO) topLayoutGuide += self.navigationController.navigationBar.bounds.size.height; } } From 88aee5d9414db94319d40a13eb2eba7a699e5516 Mon Sep 17 00:00:00 2001 From: Frank Wu Date: Fri, 9 Aug 2019 15:52:31 +0800 Subject: [PATCH 10/10] fix d8c89c's typo naming --- ICViewPager/ICViewPager/ViewPagerController.h | 2 +- ICViewPager/ICViewPager/ViewPagerController.m | 42 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ICViewPager/ICViewPager/ViewPagerController.h b/ICViewPager/ICViewPager/ViewPagerController.h index 8af632d..409d379 100644 --- a/ICViewPager/ICViewPager/ViewPagerController.h +++ b/ICViewPager/ICViewPager/ViewPagerController.h @@ -25,7 +25,7 @@ typedef NS_ENUM(NSUInteger, ViewPagerOption) { ViewPagerOptionTabOffset, ViewPagerOptionTabWidth, ViewPagerOptionTabLocation, - ViewPagerOptionTabNarmalLineWidth, + ViewPagerOptionTabNormalLineWidth, ViewPagerOptionTabSelectedLineWidth, ViewPagerOptionTabDisableTopLine, ViewPagerOptionTabDisableBottomLine, diff --git a/ICViewPager/ICViewPager/ViewPagerController.m b/ICViewPager/ICViewPager/ViewPagerController.m index d06b717..bb29107 100644 --- a/ICViewPager/ICViewPager/ViewPagerController.m +++ b/ICViewPager/ICViewPager/ViewPagerController.m @@ -17,7 +17,7 @@ #define kTabOffset 56.0 #define kTabWidth 128.0 #define kTabLocation 1.0 -#define kTabNarmalLineWidth 1.0 +#define kTabNormalLineWidth 1.0 #define kTabSelectedLineWidth 5.0 #define kTabDisableTopLine 0.0 #define kTabDisableBottomLine 0.0 @@ -68,7 +68,7 @@ @interface TabView : UIView @property (nonatomic) UIColor *indicatorColor; @property (nonatomic) BOOL disableTopLine; @property (nonatomic) BOOL disableBottomLine; -@property (nonatomic) CGFloat narmalLineWidth; +@property (nonatomic) CGFloat normalLineWidth; @property (nonatomic) CGFloat selectedLineWidth; @end @@ -77,7 +77,7 @@ - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor clearColor]; - self.narmalLineWidth = 1.0; + self.normalLineWidth = 1.0; self.selectedLineWidth = 5.0; } return self; @@ -96,7 +96,7 @@ - (void)drawRect:(CGRect)rect { [bezierPath moveToPoint:CGPointMake(0.0, 0.0)]; [bezierPath addLineToPoint:CGPointMake(CGRectGetWidth(rect), 0.0)]; [[UIColor colorWithWhite:197.0/255.0 alpha:0.75] setStroke]; - [bezierPath setLineWidth:(self.disableTopLine ? 0.0 : self.narmalLineWidth)]; + [bezierPath setLineWidth:(self.disableTopLine ? 0.0 : self.normalLineWidth)]; [bezierPath stroke]; // Draw bottom line @@ -104,7 +104,7 @@ - (void)drawRect:(CGRect)rect { [bezierPath moveToPoint:CGPointMake(0.0, CGRectGetHeight(rect))]; [bezierPath addLineToPoint:CGPointMake(CGRectGetWidth(rect), CGRectGetHeight(rect))]; [[UIColor colorWithWhite:197.0/255.0 alpha:0.75] setStroke]; - [bezierPath setLineWidth:(self.disableBottomLine ? 0.0 : self.narmalLineWidth)]; + [bezierPath setLineWidth:(self.disableBottomLine ? 0.0 : self.normalLineWidth)]; [bezierPath stroke]; // Draw an indicator line if tab is selected @@ -141,7 +141,7 @@ @interface ViewPagerController ()