Can't get scrollsToTop working on iOS7

前端 未结 6 458
我在风中等你
我在风中等你 2020-12-29 04:15

I\'m targeting iOS7 in my latest app, and tapping on the status bar doesn\'t seem to scroll a tableView or collectionView to the top.

I\'ve set self.tableView.

6条回答
  •  情书的邮戳
    2020-12-29 04:54

    Do you have more than one scroll view/table view/collection view on screen? If so, only one of them can have scrollsToTop set to YES, otherwise iOS7 will not scroll any of them to the top.

    You can also implement the UIScrollViewDelegate method scrollViewShouldScrollToTop: and return YES if the passed in scroll view is equal to the one that you want to scroll to the top:

    - (BOOL) scrollViewShouldScrollToTop:(UIScrollView*) scrollView {
        if (scrollView == self.myTableView) {
            return YES;
        } else {
            return NO;
        }
    }
    

提交回复
热议问题