UINavigationController with custom vertical button bar - ipad

I need to implement a navigation based app with a custom made button bar that stays on the vertical size of the screen, similar to Reeder iPad app (see Reeder screenshot).
What is the best way to achieve that result? I thought about adding the bar as a subview of the UINavigationController and calling its methods (like pushViewController:animated:) via the parentViewController reference from my button bar view controller, but it seems a bit convoluted.

Might work, but dangerous: set a transform on the CALayer object of the UINavigationBar. A transform that rotates the bar by "-1 * M_PI_2" would be almost right, you might need to translate it a few pixels too, to get the position correct.
Definitely works, but more effort: render a custom navbar, implement the delegate protocol from UINavigationController, and listen to the nav changing, and implement your own animations inside the callbacks.
(I've done the latter method to provide custom UINavigationBars - it works fine)
The only caveat with latter method is that your animations might pause / delay because by default they wait for each other to finish. If you look at the UIView animations, there's a setting that says "play immediately, even if other animations are in progress", and you might need to set that to YES.

Related

How do I add to a UINavigationController push animation, rather than replace it?

I implemented my own custom animation using the UIViewControllerAnimatedTransitioning protocol. However, this replaces the entire default push animation (including the navigation bar animation, and the new view sliding on top of the old one). I want to keep that stuff, and animate a simple UIView on top, which visualises how an item from the first view is being taken to the next.
Is there a way to accomplish this?
There is an "annimateAlongSide" function .... think it belongs to the TransitionCoordinator. Check that out.

iOS - 'Pan' navigation flow with Custom Transitions

I'm trying to use iOS7's custom transitions in order to let the user navigate between view controllers through a kind of 'pan' effect.
As depicted here:
I need the background pattern to continue also outside the vc's bounds, so that when the user moves from vc1 to vc2 all the background visible between the vcs translates too.
Any hint is really appreciated.
Thanks,
DAN
Have a large UIImageView with the image in the transitionContext.containerView, and change its origin as the pan gesture progresses?

Allow interactivity on UIViewController below presented UIViewController

Im presenting a UIViewController with a UIModalPresentationCustom presentation style and the presented UIViewController has it's main view's backgroundColor set to clearColor. I need to allow interactions to the UIViewController that sits below. Is this possible?
The reason Im doing this is that I have a map that needs to persistently sit below a presented UINavigationController and I need to allow interactions with it. The presented views may have content that scrolls above it, and at that time I'd like interactivity to stop (which it should by default).
You might be able to do something like this by messing with hitTest, though I wouldn't rely on that.
It seems like a popover with 'passthroughViews' might serve your purposes better. If you can't deal with the arrow, you can always set a custom UIPopoverBackgroundView.

iOS 7 UINavigationController Push animation shadow

With iOS 7 a new push animation was created, which slides the pushed view controller on top of the hierarchy. But when the animation happens, iOS apparently does two things to modify the design of the top view controller:
A shadow is added:
And a light overlay over the bottom view controller:
In most applications this is not a problem. But, I am currently working on an application with pixel perfect design and I use view controllers with clear background. But this functionality remains the same, and the light overlay appears over the view controller. Because the background is a white gradient, this light overlay (on screenshot 2) is very visible and when the animation completes, it is removed without animation, which makes it very noticeable and annoying.
I am aware I can create custom animations and transitions, but I am wondering:
Is there any way to remove (or modify) this light overlay and shadow, without having to create custom transitions?
Thank you for your help.
It's not the most elegant solution, but I've seen people use UIImage animations to show what they want shown. So, you could:
Screenshot the incoming UIViewController
Animate the arrival of a UIImageView
Call pushViewController:animated:, passing NO for animated:
Remove the UIImageView
Again, a bit of a hack, but maybe it's the best solution for your scenario.
Try this proxy
[[UIImageView appearanceWhenContainedIn:NSClassFromString(#"_UIParallaxDimmingView"), nil] setAlpha:0.0f];
I don't know if Apple allows this or not because it uses a private API. Will update when app submitted.

Specific iPad modal view

Okay, I am still learning how to program and things are moving along quite well, but I have a question for the group about something that has been plaguing me:
How do I create a pop view where the background can still be seen? I mean, say my iPad view has 5 buttons on it, and I want a small square to pop up over where that button was, asking the user a question - how would i do that? Can I make a modal view with an invisible background? (I don't want a UIAlert BTW - I know that would solve my problem, but I am trying to learn how to do this with my own view)
Can anyone point me in the right direction?
You say "pop view" which makes me think you're describing a popover. Have you read the iPad Programming Guide, specifically, the section "Creating and Presenting a Popover"? It really is required reading in this case.
Are you showing the popover from a bar button? If so, you'll want to use presentPopoverFromBarButtonItem:permittedArrowDirections:animated:. If not, you'll need to identify a CGRect that represents the button (you can use its bounds), and then use presentPopoverFromRect:inView:permittedArrowDirections:animated:.
You do not want to obscure the button with the popover. When you show the popover using the above methods, the framework will take care of positioning the popover on-screen. Use the UIPopoverArrowDirectionAny for directions whenever possible.
If you actually want to show a modal view, you can create whatever view you want and then display it in such a way that the background is not fully obscured. Just set the modalPresentationStyle of the view controller to something like UIModalPresentationPageSheet.
You should create a custom UIView with the dimensions and content that you want to display. Then, you can place the custom UIView on screen by calling something like:
//where 'self' is the view controller currently visible and 'customView' is
//the view which has the question for the user. Don't forget to set the
//frame property on customView so that it knows the correct place to display.
[self.view addSubview:customView];
Hope this helps. Andrew

Resources