forked from shadowfacts/Tusker
Fix selected segment not updating on profiles when switching tabs with keyboard shortcuts
This commit is contained in:
parent
2344275ff9
commit
10239d14c9
|
@ -12,6 +12,14 @@ class ProfileHeaderCollectionViewCell: UICollectionViewCell {
|
|||
|
||||
private var state: State = .unloaded
|
||||
|
||||
var view: ProfileHeaderView? {
|
||||
if case .view(let view) = state {
|
||||
return view
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
||||
|
|
|
@ -297,11 +297,13 @@ extension ProfileViewController: ProfileHeaderViewDelegate {
|
|||
extension ProfileViewController: TabbedPageViewController {
|
||||
func selectNextPage() {
|
||||
guard currentIndex < pageControllers.count - 1 else { return }
|
||||
currentViewController.headerCell?.view?.pagesSegmentedControl.selectedSegmentIndex = currentIndex + 1
|
||||
selectPage(at: currentIndex + 1, animated: true)
|
||||
}
|
||||
|
||||
func selectPrevPage() {
|
||||
guard currentIndex > 0 else { return }
|
||||
currentViewController.headerCell?.view?.pagesSegmentedControl.selectedSegmentIndex = currentIndex - 1
|
||||
selectPage(at: currentIndex - 1, animated: true)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue