Skip to content

Scroll to page programmatically #2

@Wirsing84

Description

@Wirsing84

Hi Jesse,
we are using CubeView extensively as one of our main UI assets. However, when it comes to the details, I'm struggling to understand your implementation, mostly because I have only a very basic understanding of CoreAnimation.

Could you hint me in a direction of how to programmatically scroll the cube to the previous/next page?
I basically get it to work by exposing the scrollView-property and using scrollRectToVisible:Animated: to scroll to multiples of the bound-width. However, this fails when there are more than 3 pages.

I'm guessing it has a lot to do with:


if ([delegate numPagesForCubeView:self] > 2) {
self.scrollView.contentSize = CGSizeMake(self.bounds.size.width * 3, self.bounds.size.height);


I think I also have a basic misconception of how the cube animation and the scrollView are coupled.

So again my question:
Could you hint me in a direction of how to programmatically scroll the cube to the previous/next page?
Ideally, how could I implement this:

  • (void)scrollCubeViewToPage:(int)page animationDuration:(NSTimeInterval)duration

Thanks a million times for your help!
Cheers
Chris

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