How to find out which other UIScrollView interferes with scrollsToTop?

后端 未结 2 1205
日久生厌
日久生厌 2021-02-03 10:40

I have several view controllers with one or multiple scrollviews. Although I have explicitly set the scrollsToTop flags in view controllers with more than one scrol

2条回答
  •  太阳男子
    2021-02-03 11:11

    I changed the accepted answers into swift for convenience:

    func findMisbehavingScrollViews() {
        var aview = UIApplication.sharedApplication().keyWindow
        findMisbehavingScrollViewsIn(aview!)
    }
    
    func findMisbehavingScrollViewsIn(aview: UIView) {
        if aview.isKindOfClass(UIScrollView) {
            if (aview as! UIScrollView).scrollsToTop {
                print("found uiscrollview \(aview)")
            }
        }
        for bview in aview.subviews {
            findMisbehavingScrollViewsIn(bview)
        }
    }
    

提交回复
热议问题