views:

293

answers:

1

I have a normal UINavigationController with a UIViewController contained in it, when my view controller has a prompt applied to it (via a UINavigationItem.prompt = @"some prompt"), the prompt is animating the UIViewController's view downward.

My question is, is there an apple what to find out that a prompt will appear (and maybe the animation time it will take) so I can relayout the view? For example: so the content appears not to move. Or do I have to write this functionality myself. What i am really looking for is a notification similar to the KeyboardWillShow/Hide notifications.

Note that the controller is not the object applying the prompt, and the prompt will appear and disappear asynchronously. Not looking for code, just advice.

A: 

You can always use kvo to get a callback whenever the value changes. As for the time taken, it may be just the default (0.25 seconds) or it may use the UINavigationControllerHideShowBarDuration constant. I imagine that you really only need to get it "close enough" when dealing with this animation.

Ed Marty
that is a good idea! thanks.
deoryp
Thanks to Ed, I have a solution that works quite well:in viewDidAppear i register for "prompt" on navigationItem, in viewDidDisappear I unregister. then it is just looking at the changes to see if i need to move my content. read this for more info: http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/KeyValueObserving/Concepts/KVOBasics.htmlFyi: the animation duration is .35 and it moves 30 pixels.
deoryp