0

I looked in this thread and tried everything I saw, and I can't seem to get it working.

Scroll to top of UITableView by tapping status bar

I have a UINavigationController and a UITabBarController. The application first opens to a UICollectionView.

When the user makes a selection, it brings up a ScrollView run by a custom UIViewController ("ScrollViewController"). The ScrollViewController makes four TableViewControllers and puts their TableViews in the ScrollView side by side with paging enabled, and has a floating UIPageControl as well.

Tapping the top bar scrolls the CollectionView to the top, but once I bring up the ScrollView, I can't scroll up from anywhere. I have tried setting all the TableViews' scrollsToTop to NO, no change.

Any suggestions?

Community
  • 1
  • 1
Praxis
  • 95
  • 1
  • 9

1 Answers1

2

That's correct. You can only have one scroll view controlled by the tap of the status bar. If you have multiple scroll views on the screen (either hidden or visible) you can set one of them to be controlled by the status bar tap by disabling the auto scroll on all of the other scroll views using scrollsToTop = NO, that includes anything that uses a scroll view within it, like a table view or a pager.

self.myTableView.scrollsToTop = NO;

According to Apple's documentation:

On iPhone, the scroll-to-top gesture has no effect if there is more than one scroll view on-screen that has scrollsToTop set to YES.

Brian Shamblen
  • 4,653
  • 1
  • 23
  • 37
  • Right, but that's my problem...I have already set all four TableViews' scrollsToTop to NO, and the ScrollView that contains them to YES, and it didn't fix the problem. Is there a scrollsToTop on UIPageControl? I couldn't find it. – Praxis Dec 01 '14 at 20:02
  • The UIScrollView is used within UICollectionView, UITableView and UITextView. If you have any those rendered, even off screen or hidden it will cause the problem. In my case I was using a UITableView inside the MMDrawerController (open source), to create a drawer menu. The table view inside the drawer controller was causing the problem, even when it was off screen. – Brian Shamblen Dec 01 '14 at 21:56