When an app you are writing is intended to have a highly customized look one of the things that may get special treatment is the UINavigationItem for view controllers that are managed by a UINavigationBar object.
Each UIViewController has its own UINavigationItem property that is pushed or popped by a UINavigationBar object that lays out navigation bar at the top of the view.
I had two goals. 1) Drop custom left and right bar button items and custom text on the navigation bar and 2) Customize the animations between the navigation items in the navigation bar. So I needed to sub-class UINavigationBar for 2). And I needed to create a custom UINavigationItem that I could reuse everywhere and give the app a consistent look and feel. This would satisfy 1).
Showing posts with label UINavigationController. Show all posts
Showing posts with label UINavigationController. Show all posts
Friday, February 7, 2014
Wednesday, January 15, 2014
UIViewControllerTransitioningDelegate vs. UINavigationControllerDelegate
In my previous post I wrote about using iOS 7's new customization animations for transitioning between UIViewControllers. What I didn't realize is that the mechanism by which a UINavigationController customizes its transitions is different from the way other UIViewController subclasses do.
I had declared that my custom UINavigationController conformed to the UIViewControllerTransitioningDelegate protocol and had coded up the required protocol methods and the different animation controllers (UIViewControllerAnimatedTransitioning) and then was deflated when nothing was calling my UIViewControllerTransitioningDelegate methods.
Upon further research I found that my navigation controller actually needed its 'delegate' property set to an object conforming to the UINavigationControllerDelegate protocol and this object would serve up the appropriate animation controllers for the push and pop operations.
It was a slightly difficult distinction to find, but once I implemented the methods I found that (half) my animations (nearly) worked.
I had declared that my custom UINavigationController conformed to the UIViewControllerTransitioningDelegate protocol and had coded up the required protocol methods and the different animation controllers (UIViewControllerAnimatedTransitioning) and then was deflated when nothing was calling my UIViewControllerTransitioningDelegate methods.
Upon further research I found that my navigation controller actually needed its 'delegate' property set to an object conforming to the UINavigationControllerDelegate protocol and this object would serve up the appropriate animation controllers for the push and pop operations.
It was a slightly difficult distinction to find, but once I implemented the methods I found that (half) my animations (nearly) worked.
Tuesday, January 14, 2014
UINavigationController Custom Animations In iOS 7
Prior to iOS 7, implementing custom transitioning animations from a UINavigationController's push and pop methods required quite a bit of hackery. Early on in my own development efforts I made an attempt to override the standard animation transitions in my own UINavigationController subclass, but ultimately had to throw them onto the backburner; forever enclosed in comments.
My current sprint, however, has included a story that forced me to go back and revisit my painful experiences. I can't expect my app to stand out from the others using the regular ol' transitions packaged by iOS. Fortuitously I managed to stumble upon these two excellent primers on iOS 7's new offerings:
My current sprint, however, has included a story that forced me to go back and revisit my painful experiences. I can't expect my app to stand out from the others using the regular ol' transitions packaged by iOS. Fortuitously I managed to stumble upon these two excellent primers on iOS 7's new offerings:
Subscribe to:
Posts (Atom)