Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Page on Top & Below #18

Closed
otymartin opened this issue Mar 12, 2017 · 7 comments
Closed

Support for Page on Top & Below #18

otymartin opened this issue Mar 12, 2017 · 7 comments

Comments

@otymartin
Copy link

@msaps
Is there any plan to support pages on top or below?
Im looking to create a 3 page view [Left, Center, Top] where Top is above Left.

Also side question didnt want to raise issue but can bounce be disabled on First and Last page?

@msaps
Copy link
Member

msaps commented Mar 12, 2017

Hi,

As Pageboy is just a wrapper around UIPageViewController that sort of layout isn't really possible. The navigationOrientation can be changed to achieve either horizontal/vertical page layout but unfortunately not a hybrid of the two.

You could probably achieve this sort of layout using a horizontal Pageboy and a scroll view / gesture recognizer combination to get the top view controller?

I'll raise a separate issue and get a bounces property added in the next release. 👍

@otymartin
Copy link
Author

@msaps Thanks
Just a one more question on the layout i want [Left, Center, Top]
What I technically want do is 3 pages [left, center, top], but User can only swipe between left and center. Going to the top I'd rather use a button to present the top view. Reason being I want a camera view in that top page so that its already loaded. Currently I hate that I have to stare at a black screen for 3-5 seconds before my cameraViewController previewlayer loads.

Can I do that? Present a page without the swipe/transition animation? and prevent swipe to either first page, last page or both?

@msaps
Copy link
Member

msaps commented Mar 13, 2017

@otymartin you could achieve that view hierarchy with something like this:

ParentViewController
     -> UIScrollView
          -> TopViewController
          -> PageboyViewController
               -> LeftViewController
               -> CenterViewController

You could then switch between the (Left/Center) pages and the top view controller by having a button which adjusts the scroll view's contentOffset to the required state value. Just have the UIScrollView with scrollEnabled set to false.

@msaps
Copy link
Member

msaps commented Mar 13, 2017

@otymartin a bounces property is now available in PageboyViewController as of 0.4.11 😄

@msaps msaps closed this as completed Mar 13, 2017
@msaps msaps reopened this Mar 13, 2017
@otymartin
Copy link
Author

@msaps
Hey thanks for the detailed responses with suggestions. I'll be implementing this library tomorrow and thanks for adding the bounces property. althougth the more I try the example, i'm attracted to the interpolating background color effect your have where it darkens as you try to scroll beyond the bounds of the scroll view.
very nice!

@msaps
Copy link
Member

msaps commented Mar 15, 2017

@otymartin no worries! The gradient interpolation code is in found in the following functions:

func updateAppearance(pageOffset: CGFloat) 

func gradient(forIndex index: Int) -> GradientConfig

func interpolate(betweenColor colorA: UIColor,
                 and colorB: UIColor,
                 percent: CGFloat) -> UIColor?

in PageViewControllerAppearance.swift.

@otymartin
Copy link
Author

@msaps very nice, I love how they blend in so nicely its just awesome. Makes the infinite scroll more seamless

@msaps msaps closed this as completed Mar 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants