fix of separator setup

This commit is contained in:
Eugene Pravda 2016-09-21 18:20:55 +03:00
parent 01315e2bb8
commit e5fad7e0c2
1 changed files with 8 additions and 4 deletions

View File

@ -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()