I'm trying to create a customized NavigationViewController
where the Navigation bar is a swipeable bar at the top that controls the transitions (think UITabBarController
but with swipe gestures not buttons). Here is a quick mockup. I apologize for the crudeness
I have the header bar set up as a ScrollView. I have been able to successfully detect the scroll amount using the scrollViewDidScroll
method. So I have the header bar portion rigged up. I now need to implement the transition movement in the scrollViewDidScroll
method.
I have looked up the Apple Documentation on how to embed view controllers inside each other but it hasn't really helped explain how to do this. The documentation mentions calling the addChildViewController:
method and a bunch of other methods which are fine if I want to make the viewControllers disappear and reappear instantly, but in this scenario I'm finding hard to do it interactively.
Do I create a snapshot of the current VC and then move it? But then what exactly am I moving? In the picture for example, am I moving the entire RedVC's to the left? But then how do I get a snapshot of the BlueVC if it starts moving from outside the frame? What if I want to load in images asynchronously in the BlueVC? Will I have to use a placeholder snapshot with placeholders until the BlueVC snaps in place?
This is all becoming so convoluted... I've done stuff like this separately (snapshots, custom VC transitions, etc..) but I'm not comfortable enough in combining them all in a case like this. I'm sure I can hack up some way given enough time, but I want to learn what is the best, cleanest way.
I appreciate any help! Thanks.
Edit after accepting @MilanNosáľ's answer:
I ended up using his framework as linked in this repo. It's not interactive yet, but I can figure out the rest using what they've very graciously done for me. I wish I could post the full code here, but that's not very practical. The repo will remain up indefinitely for future SO travelers.
I initially had Milan's answer selected as the final answer to the question. But, after I tried working on it for the past few weeks, with a lot of help from him, we both agreed it was too difficult to integrate his framework into a format useable for this task. I'm now working on just using a UIScrollView
for the ViewControllers below, and let the HeaderView
above (the thing with the labels) control the ViewControllers' scroll view below.