uias / Pageboy

📖 A simple, highly informative page view controller
MIT License
1.99k stars 155 forks source link

NavigationBar Item Transition on Swipe #138

Closed otymartin closed 6 years ago

otymartin commented 6 years ago

@msaps Is it possible to have navigation bar items and titles transition in the manner shown below (Either with Pageboy or Tabman)? It makes for a very simple & intuitive navigation scheme in my opinion.

nav

msaps commented 6 years ago

@otymartin sorry I didn't reply on Twitter, been super busy lately!

This should actually be possible (maybe?) with Tabman currently. I'll check it out and see if I can get the appearance config you'll need to make this work. If not I'll raise a relevant issue in Tabman for what we need, but it should be possible! 🤞

otymartin commented 6 years ago

@msaps Beautiful, man much appreciated. Looking forward to it.

otymartin commented 6 years ago

@msaps Hey im looking to hack together a premature implementation of this to push to an existing app fast on Appstore while I await your official implementation, I was wondering if you can give me some logical guidance for how to achieve the appearance config needed for this behaviour.

So far my only ideas are to use a custom TabmanBar, center distributed and figure out the right amount of spacing between each barItem.

Then use this delegate method to update the position of each element relative (assuming the X position of each barItem can be manipulated) to the swipe direction and destination page. Any other hints?

override func update(forPosition position: CGFloat,
                direction: PageboyViewController.NavigationDirection,
                indexRange: Range<Int>,
                bounds: CGRect) { }
msaps commented 6 years ago

@otymartin apologies, having looked at the effect a bit more properly I don't think this exact style can be achieved by vanilla Tabman currently. 👎

But yeah you are on the right track with a custom bar! The custom support available in 1.X is pretty rudimentary, as it wasn't a big priority for getting Tabman out there! Hopefully going to improve this with 2.0...

But anyway..

I think you're pretty spot on with how to achieve it. The tricky part will be figuring out the correct X spacing between the items. Tabman provides no interference or help with creating your bar, just gives the raw values for updating and lifecycle functions currently. So you are free to use whatever view components for the bar items and manipulate them however you want!

Appreciate this isn't the most helpful for extending easily, but as I said, v1.0 😄

otymartin commented 6 years ago

@msaps Ok great, let me give this a try. Thanks :)

msaps commented 6 years ago

@otymartin going to close this as it's more of a Tabman issue, but please feel free to raise something in there with how you get on / if you need any help 🙂