From 85bed4548be731923793cc94a8250b82bee5c5bd Mon Sep 17 00:00:00 2001 From: pauluhn Date: Thu, 17 Aug 2017 16:55:55 -0500 Subject: [PATCH 1/2] Add horizontal separator none. --- Segmentio/Source/Segmentio.swift | 4 ++++ Segmentio/Source/SegmentioOptions.swift | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Segmentio/Source/Segmentio.swift b/Segmentio/Source/Segmentio.swift index b4797b9..da082a7 100644 --- a/Segmentio/Source/Segmentio.swift +++ b/Segmentio/Source/Segmentio.swift @@ -112,6 +112,8 @@ open class Segmentio: UIView { let separatorHeight = horizontalSeparatorOptions.height switch horizontalSeparatorOptions.type { + case .none: + separatorsHeight = 0 case .top: collectionViewFrameMinY = separatorHeight separatorsHeight = separatorHeight @@ -511,6 +513,8 @@ open class Segmentio: UIView { let isIndicatorTop = indicatorOptions.type == .top switch horizontalSeparatorOptions.type { + case .none: + break case .top: indicatorPointY = isIndicatorTop ? indicatorPointY + separatorHeight : indicatorPointY case .bottom: diff --git a/Segmentio/Source/SegmentioOptions.swift b/Segmentio/Source/SegmentioOptions.swift index 9c6f641..41cd185 100644 --- a/Segmentio/Source/SegmentioOptions.swift +++ b/Segmentio/Source/SegmentioOptions.swift @@ -56,7 +56,7 @@ public struct SegmentioState { // MARK: - Horizontal separator public enum SegmentioHorizontalSeparatorType { - + case none case top case bottom case topAndBottom From 1b6a38609ef0691195586d54845210804fdc4135 Mon Sep 17 00:00:00 2001 From: pauluhn Date: Thu, 17 Aug 2017 18:09:58 -0500 Subject: [PATCH 2/2] Fix UI bug. --- Segmentio/Source/Segmentio.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Segmentio/Source/Segmentio.swift b/Segmentio/Source/Segmentio.swift index da082a7..ad7f709 100644 --- a/Segmentio/Source/Segmentio.swift +++ b/Segmentio/Source/Segmentio.swift @@ -253,7 +253,7 @@ open class Segmentio: UIView { bottomSeparatorView = UIView(frame: CGRect.zero) setupConstraintsForSeparatorView( separatorView: bottomSeparatorView, - originY: frame.maxY - height + originY: bounds.maxY - height ) } } @@ -271,7 +271,7 @@ open class Segmentio: UIView { item: separatorView, attribute: .top, relatedBy: .equal, - toItem: superview, + toItem: self, attribute: .top, multiplier: 1, constant: originY