From e5fad7e0c2bcd1e38bbc96a23449507ca94d3e5e Mon Sep 17 00:00:00 2001 From: Eugene Pravda Date: Wed, 21 Sep 2016 18:20:55 +0300 Subject: [PATCH] fix of separator setup --- Segmentio/Source/Segmentio.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Segmentio/Source/Segmentio.swift b/Segmentio/Source/Segmentio.swift index 6223faf..dd1c991 100644 --- a/Segmentio/Source/Segmentio.swift +++ b/Segmentio/Source/Segmentio.swift @@ -192,7 +192,7 @@ public class Segmentio: UIView { } } - setupHorizontalSeparator() + setupHorizontalSeparatorIfPossible() setupCellWithStyle(segmentioStyle) segmentioCollectionView?.reloadData() } @@ -200,9 +200,7 @@ public class Segmentio: UIView { public override func didMoveToSuperview() { super.didMoveToSuperview() - if superview != nil && segmentioOptions.horizontalSeparatorOptions != nil { - setupHorizontalSeparator() - } + setupHorizontalSeparatorIfPossible() } // MARK: Collection view setup @@ -235,6 +233,12 @@ public class Segmentio: UIView { // MARK: Horizontal separators setup + private func setupHorizontalSeparatorIfPossible() { + if superview != nil && segmentioOptions.horizontalSeparatorOptions != nil { + setupHorizontalSeparator() + } + } + private func setupHorizontalSeparator() { topSeparatorView?.removeFromSuperview() bottomSeparatorView?.removeFromSuperview()