hotfix/fix-child-appearance-methods
Call appearance methods for visible screen (at current index).
This commit is contained in:
parent
e60bc99b31
commit
0e8b439a0c
|
@ -67,6 +67,22 @@ class ContainerLifeCycleController {
|
|||
func update(currentIndex index: Int) {
|
||||
state = .changing(toIndex: index)
|
||||
}
|
||||
|
||||
func startAppearanceForCurrentIndex() {
|
||||
startAppearance(for: menuDataSource.currentIndex)
|
||||
}
|
||||
|
||||
func endAppearanceForCurrentIndex() {
|
||||
endAppearance(for: menuDataSource.currentIndex)
|
||||
}
|
||||
|
||||
func startDisappearanceForCurrentIndex() {
|
||||
startDisappearance(for: menuDataSource.currentIndex)
|
||||
}
|
||||
|
||||
func endDisappearanceForCurrentIndex() {
|
||||
endDisappearance(for: menuDataSource.currentIndex)
|
||||
}
|
||||
|
||||
// MARK: Private functionality
|
||||
|
||||
|
|
|
@ -148,11 +148,30 @@ public class HorizontalMenuViewController: UIViewController, MenuDataSource, Pag
|
|||
initializeSubviews()
|
||||
initializeControllers()
|
||||
}
|
||||
|
||||
public override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
containerLifeCycleController.startAppearanceForCurrentIndex()
|
||||
}
|
||||
|
||||
public override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
selectionController.selectItem(at: paginationController.currentIndex)
|
||||
containerLifeCycleController.endAppearanceForCurrentIndex()
|
||||
}
|
||||
|
||||
public override func viewWillDisappear(_ animated: Bool) {
|
||||
super.viewWillDisappear(animated)
|
||||
|
||||
containerLifeCycleController.startDisappearanceForCurrentIndex()
|
||||
}
|
||||
|
||||
public override func viewDidDisappear(_ animated: Bool) {
|
||||
super.viewDidDisappear(animated)
|
||||
|
||||
containerLifeCycleController.endDisappearanceForCurrentIndex()
|
||||
}
|
||||
|
||||
public override func viewDidLayoutSubviews() {
|
||||
|
|
|
@ -28,6 +28,9 @@ public protocol MenuDataSource: class {
|
|||
/// Boolean to configure if the intermediate screens on menu item selection should be loaded
|
||||
var preloadIntermediateScreensOnSelection: Bool { get }
|
||||
|
||||
/// The current index of pagination.
|
||||
var currentIndex: Int { get }
|
||||
|
||||
/// The number of elements is the same for items and screen.
|
||||
/// However the items.count might be 0 because they are optional.
|
||||
var numberOfElements: Int { get }
|
||||
|
|
Loading…
Reference in New Issue