Search code examples
iphoneanimationuinavigationcontrolleruinavigationbarpushviewcontroller

Animate NavigationBar à la pushViewController w/o changing the viewController


I have a viewController showing an UIWebView. Inside of that UIWebView I have a Sencha Touch App running. On top of that UIWebView sits the native UINavigationBar (not Sencha Touch).

Inside the Sencha Touch App, the user can switch the screens back and forth. Sencha Touch animates those switches, as they would be if I had called pushViewController in my native app.

Of course those animations coming from my Sencha Touch App don't change the native UINavigationBar. I can manually change the left/rightBarButtonItems and the navigationitem.title. But I would like those changes to be animated as if I would have called pushViewController.

Is there any way to get those animations on the UINavigationBar without actually changing or animating the UIWebView? Any idea's pointing me in the right direction how to achieve that would be well appreciated…


Solution

  • Have you tried pushNavigationItem:animated method of UINavigationBar? You can create instances on UINavigationItem and keep pushing and popping them from navigation bar as you like. UINavigationItem also has title property which will take care of navigation titles and back buttons.

    Read this for more details: http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationBar_Class/Reference/UINavigationBar.html