-1

Sorry I'm new to Objective c / iOS dev.

So I have two view controllers displaying separate views on one iOS page written in objective C. Two view controllers

View 1 is a static page. View 2 is a scrollable list (UICollectionViewDataSource) that I plan to implement an infinite scroll in.

Right now view 1 scrolls up and down as expected. View 2 sometimes depending on how you tap the screen scrolls as one with view 1 (they both go up and down together) and it sometimes scrolls under view controller 1. How can I create a permanent behavior where they scroll together? I want them to move as if they are connected (as if I were scrolling through a web page that had a table that I could scroll down through).

I searched around (I may be using the wrong search terms) but everything I see has to do with switching between two or more view controllers. (ex Swipe between two UIViewControllers' views)

In case it is unclear I want the following behavior:

Original Page:

xxx
xyx
xxx
111
222

Scroll down:

xyx
xxx
111
222
333

Continue sroll:

xxx
111
222
333
444

That sometimes happens but I'm also seeing:

xxx
xyx
xxx
222
333

Or even:

xxx
xyx
xxx
(background color blank space)
111
222

It looks clearly disjoint.

Community
  • 1
  • 1
Tai
  • 1,206
  • 5
  • 23
  • 48
  • "So I have two view controllers on one iOS page" No, you don't. A view controller is not something that appears in the interface. It's a controller, not a view. – matt Apr 12 '16 at 00:11
  • Why don't you put the whole thing in one tableView? – Jef Apr 12 '16 at 02:23
  • @Jef so put the static page in a header? of the table view? – Tai Apr 12 '16 at 17:50
  • Sure. Put zero rows in section zero, and use its (section 0's) header view for the upper container. – Jef Apr 14 '16 at 23:22

1 Answers1

0

I have not coded this, but I have some ideas. Firstly I think you will have to hook onto the scroll views used by the table views. In each controller I would add overrides for UIScrollViewDelegate methods so you can detect the scrolling. Then in those methods, update the scroll view position of the other table view.

That would be my first approach.

drekka
  • 20,957
  • 14
  • 79
  • 135