Merge pull request #246 from abeyuya/fix/ButtonBarView-selectedBar-YPosition

update-selectedBar-yposition-when-use-autolayout
This commit is contained in:
Martin Barreto 2017-01-25 14:26:06 -03:00 committed by GitHub
commit 357d6c7bc6
1 changed files with 7 additions and 2 deletions

View File

@ -47,7 +47,7 @@ open class ButtonBarView: UICollectionView {
internal var selectedBarHeight: CGFloat = 4 {
didSet {
updateSlectedBarYPosition()
updateSelectedBarYPosition()
}
}
var selectedBarAlignment: SelectedBarAlignment = .center
@ -63,6 +63,11 @@ open class ButtonBarView: UICollectionView {
addSubview(selectedBar)
}
override open func layoutSubviews() {
super.layoutSubviews()
updateSelectedBarYPosition()
}
open func moveTo(index: Int, animated: Bool, swipeDirection: SwipeDirection, pagerScroll: PagerScroll) {
selectedIndex = index
updateSelectedBarPosition(animated, swipeDirection: swipeDirection, pagerScroll: pagerScroll)
@ -165,7 +170,7 @@ open class ButtonBarView: UICollectionView {
return contentOffset
}
private func updateSlectedBarYPosition() {
private func updateSelectedBarYPosition() {
var selectedBarFrame = selectedBar.frame
selectedBarFrame.origin.y = frame.size.height - selectedBarHeight
selectedBarFrame.size.height = selectedBarHeight