update-selectedBar-yposition-when-use-autolayout
This commit is contained in:
parent
d12b4fa6c5
commit
9bdd6acfbc
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue