From 8f2be050d1a85d01b6f3102392af54b9555d9bad Mon Sep 17 00:00:00 2001 From: Wojciech Rutkowski Date: Fri, 5 Feb 2016 16:54:41 +0000 Subject: [PATCH 1/2] Added possibility to turn off adjusting button heights by indicator height - used for high indicators as in implemented example --- ScrollPager/Base.lproj/Main.storyboard | 87 +++++++++++++++++++++----- ScrollPager/Source/ScrollPager.swift | 10 ++- ScrollPager/ViewController.swift | 11 +++- 3 files changed, 88 insertions(+), 20 deletions(-) diff --git a/ScrollPager/Base.lproj/Main.storyboard b/ScrollPager/Base.lproj/Main.storyboard index 7388370..b89ea5a 100644 --- a/ScrollPager/Base.lproj/Main.storyboard +++ b/ScrollPager/Base.lproj/Main.storyboard @@ -1,7 +1,8 @@ - + - + + @@ -20,7 +21,7 @@ - + @@ -102,6 +103,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -111,15 +148,23 @@ + + + + + + + + @@ -133,11 +178,9 @@ + - - - @@ -148,12 +191,19 @@ - - - + + + + + + + + + + @@ -168,33 +218,40 @@ + - - - + + + + + + + + + + - - - + + diff --git a/ScrollPager/Source/ScrollPager.swift b/ScrollPager/Source/ScrollPager.swift index aba78f1..022b4cc 100644 --- a/ScrollPager/Source/ScrollPager.swift +++ b/ScrollPager/Source/ScrollPager.swift @@ -76,6 +76,10 @@ import UIKit @IBInspectable public var indicatorHeight: CGFloat = 2.0 { didSet { redrawComponents() } } + + @IBInspectable public var indicatorHeightShouldAdjustButtonHeight: Bool = true { + didSet { redrawComponents() } + } @IBInspectable public var borderColor: UIColor? { didSet { self.layer.borderColor = borderColor?.CGColor } @@ -187,8 +191,8 @@ import UIKit } addSubview(button) - addSubview(indicatorView) - } + } + insertSubview(indicatorView, belowSubview: buttons.first!) } private func moveToIndex(index: Int, animated: Bool, moveScrollView: Bool) { @@ -245,7 +249,7 @@ import UIKit } let width = frame.size.width / CGFloat(buttons.count) - let height = frame.size.height - indicatorHeight + let height = frame.size.height - (indicatorHeightShouldAdjustButtonHeight ? indicatorHeight : 0) for i in 0.. Date: Tue, 16 Feb 2016 16:45:43 +0000 Subject: [PATCH 2/2] Added possibility to turn off adjusting... + PR fixes --- ScrollPager/Source/ScrollPager.swift | 14 +++++++------- ScrollPager/ViewController.swift | 18 +++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ScrollPager/Source/ScrollPager.swift b/ScrollPager/Source/ScrollPager.swift index 022b4cc..411f1cf 100644 --- a/ScrollPager/Source/ScrollPager.swift +++ b/ScrollPager/Source/ScrollPager.swift @@ -76,10 +76,10 @@ import UIKit @IBInspectable public var indicatorHeight: CGFloat = 2.0 { didSet { redrawComponents() } } - - @IBInspectable public var indicatorHeightShouldAdjustButtonHeight: Bool = true { - didSet { redrawComponents() } - } + + @IBInspectable public var indicatorHeightShouldAdjustButtonHeight: Bool = true { + didSet { redrawComponents() } + } @IBInspectable public var borderColor: UIColor? { didSet { self.layer.borderColor = borderColor?.CGColor } @@ -191,8 +191,8 @@ import UIKit } addSubview(button) - } - insertSubview(indicatorView, belowSubview: buttons.first!) + } + insertSubview(indicatorView, atIndex: 0) } private func moveToIndex(index: Int, animated: Bool, moveScrollView: Bool) { @@ -249,7 +249,7 @@ import UIKit } let width = frame.size.width / CGFloat(buttons.count) - let height = frame.size.height - (indicatorHeightShouldAdjustButtonHeight ? indicatorHeight : 0) + let height = frame.size.height - (indicatorHeightShouldAdjustButtonHeight ? indicatorHeight : 0) for i in 0..