From 16f8989036d5898cd504e480ac33a01ccc953a0a Mon Sep 17 00:00:00 2001 From: "Khan, Arshad" Date: Fri, 9 Oct 2020 23:03:02 +0530 Subject: [PATCH] implemented review feedback --- .../ScrollingViewController.swift | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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 //--------------------------------------------------