Merge pull request #61 from pauluhn/horizontal-none

Horizontal separator
This commit is contained in:
Elias Tykhonkov 2017-09-02 12:49:24 +03:00 committed by GitHub
commit 42194e99c9
2 changed files with 7 additions and 3 deletions

View File

@ -113,6 +113,8 @@ open class Segmentio: UIView {
let separatorHeight = horizontalSeparatorOptions.height
switch horizontalSeparatorOptions.type {
case .none:
separatorsHeight = 0
case .top:
collectionViewFrameMinY = separatorHeight
separatorsHeight = separatorHeight
@ -252,7 +254,7 @@ open class Segmentio: UIView {
bottomSeparatorView = UIView(frame: CGRect.zero)
setupConstraintsForSeparatorView(
separatorView: bottomSeparatorView,
originY: frame.maxY - height
originY: bounds.maxY - height
)
}
}
@ -270,7 +272,7 @@ open class Segmentio: UIView {
item: separatorView,
attribute: .top,
relatedBy: .equal,
toItem: superview,
toItem: self,
attribute: .top,
multiplier: 1,
constant: originY
@ -512,6 +514,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:

View File

@ -58,7 +58,7 @@ public struct SegmentioState {
// MARK: - Horizontal separator
public enum SegmentioHorizontalSeparatorType {
case none
case top
case bottom
case topAndBottom