diff --git a/MVMCoreUI/BaseControllers/ScrollingViewController.swift b/MVMCoreUI/BaseControllers/ScrollingViewController.swift index 7b368e2a..fcbcf878 100644 --- a/MVMCoreUI/BaseControllers/ScrollingViewController.swift +++ b/MVMCoreUI/BaseControllers/ScrollingViewController.swift @@ -50,14 +50,6 @@ open class ScrollingViewController: ViewController { dismissKeyboardTapGesture?.isEnabled = false scrollView.alwaysBounceVertical = false scrollView.delegate = self - // will change scrollView indicatorStyle automatically on the basis of backgroundColor - var componentWhite:CGFloat = 0 - var componentAlpha:CGFloat = 0 - if let grayScale = view.backgroundColor?.getWhite(&componentWhite, alpha: &componentAlpha), grayScale - { - scrollView.indicatorStyle = componentWhite > 0 ? .black : .white - } - scrollView.flashScrollIndicators() } open override func viewDidLayoutSubviews() { @@ -71,6 +63,16 @@ open class ScrollingViewController: ViewController { registerForKeyboardNotifications() } + open override func handleNewData() { + super.handleNewData() + // will change scrollView indicatorStyle automatically on the basis of backgroundColor + var greyScale: CGFloat = 0 + if view.backgroundColor?.getWhite(&greyScale, alpha: nil) ?? false { + scrollView.indicatorStyle = greyScale > 0.5 ? .black : .white + } + scrollView.flashScrollIndicators() + } + //-------------------------------------------------- // MARK: - Keyboard Handling //--------------------------------------------------