5

I realize variations of this question have been asked, but I'm having trouble connecting the dots into a coherent solution for my problem. So here's my scenario:

I have a UITableView that has 2 sections. Section 1 has no header view, and 1 cell. Section 2 has a header view (it floats as is the default behavior with plain table views), and 1 cell. This solitary section 1 cell has a horizontally paging scrollview with 3 pages. Each page is a tableview. This sounds a little nutty, but it is totally legal and makes perfect sense. My scenario is a user profile screen. Section 1's cell is the user's bio. Section 2's header is a paging menu that shows the three menu options. The pager has three tableviews for all the content a user publishes, follows, and their posts.

enter image description here

The problem is that when the user scrolls any of the inner tableviews in the pager, I want the outer tableview to scroll until the bio is scrolled off screen and the section header hits the nav bar of the view controller. And then I want the inner scrollview to take over the scrolling.

I've been playing with a combination of the UIGestureRecognizerDelegate methods: shouldRecognizeSimultaneouslyWithGestureRecognizer & shouldRequireFailureOfGestureRecognizer. I am able to either scroll the tableviews simultaneously (which, btw, isn't terrible, but it's definitely not my desired behavior) or just enable scrolling on either the inner or outer tableview. I would love to be able to solve this problem using the UIGestureRecognizerDelegate because my gut tells me that the solution doesn't need to involve any delegation and overriding contentOffsets using UIScrollViewDelegate methods like scrollViewDidScroll: and so on. But maybe I'm wrong, and I will have to go that route.

Thought I'd throw this up there before I threw in the towel. Would appreciate any help!

rainypixels
  • 587
  • 4
  • 12
  • Have you watched any of the advanced table view videos from WWDC in the last few years? One or two of them dealt in nested scroll views. I remember solutions using `scrollViewDidScroll:` as you noted, and also some solutions where they transplanted the gesture recognizer of the scroll view. – Charles A. Oct 17 '15 at 18:33
  • @CharlesA. I did a while back. But it seems like it's time to watch them again. :/ – rainypixels Oct 18 '15 at 00:09

0 Answers0