Skip to content

Infinite Scroll / Only 1 (or 2) VC? #4

@stuffmc

Description

@stuffmc

There are a lot of places where you have Asserts to check that the current VC is not the same as the previous. Is there a reason? I'm in the situation where I want to show the same "data" over and over if there's only one. If I create a new VC everytime, it means I enter 3 times in my viewDidLoad. Same goes with only 2 records, I'll enter twice in the "next" and "previous" which would be the same. To schematize:

| A | A | A | — will enter 3 times in viewDidLoad for A if I want to comply to the NSAsserts
| A | B | A | — will enter twice for B.

I've tried ignoring (commenting) those Asserts, but then I have a blank page instead of the actual first VC. I can swipe to the second though.

What I did is

- (UIViewController *)pageViewController:(UIPageViewController *)pvc viewControllerBeforeViewController:(DataViewController *)vc
{
    if (self.modelController.pageData.count == 1) {
        return vc;
    }
...

My guess is that it's if I do so, the VC gets "moved" to the left every time, so it doesn't appear in the first place. Maybe I could also have my viewDidLoad code to be only started when the view is actually shown — which is not viewDid/WillAppear since that gets triggered at the beginning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions