ngochiencse / HPParallaxHeader

Simple parallax header for UIScrollView.
MIT License
55 stars 16 forks source link

[Feature] Add scrollViewDidScroll method #9

Closed sugitatestblue closed 2 years ago

sugitatestblue commented 2 years ago

Could you append scrollViewDidScroll for HPScrollViewDelegate?

ngochiencse commented 2 years ago

HPScrollViewDelegate extends from UIScrollViewDelegate so of course it supports scrollViewDidScroll by default. Example:

class HPScrollViewExample: HPParallaxHeaderDelegate {    
    @IBOutlet weak var scrollView: HPScrollView!
    // ...    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Parallax Header
        // ...
        scrollView.delegate = self
    }
}

extension HPScrollViewExample: HPScrollViewDelegate {
    func scrollViewShouldScroll(_ scrollView: HPScrollView, with subView: UIScrollView) -> Bool {
        return true
    }

    func scrollViewDidScroll(_ scrollView: UIScrollView) {
        print("scrollViewDidScroll")
    }
}