implemented review feedback

This commit is contained in:
Khan, Arshad 2020-10-09 23:03:02 +05:30
parent 101e1422f3
commit 16f8989036

View File

@ -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
//--------------------------------------------------