views:

539

answers:

2

Is it possible to make calls to navigationItem on a UIImagePickerController? Specifically, the image picker? Below I've linked an image of what I'm trying to achieve ( screen shot taken from another app doing the same thing). Once the user selects an image from the picker the navigationItem.prompt is set and, though I think it might be a HIG violation, the right bar button is changed from the standard cancel button. I can set the prompt on a "normal" view no problem with:

self.navigationItem.prompt = myString;

But this does not seem to work when I try to use it in the context of a picker with:

myPicker.navigationItem.prompt = myString;

I've tried using it when the picker is created and also in didFinishPickingMediaWithInfo: which is really where I need to set it as I'm letting the user select multiple images instead of dismissing the picker as soon as one image is selected. Nothing seems to work.

Here's a image of the desired behavior:

http://i51.photobucket.com/albums/f353/zoso5th/after.png

+1  A: 

Someone answered this for me on the Apple dev forums:

UINavigationBar *bar = picker.navigationBar;
UINavigationItem *navItem = bar.topItem;
navItem.prompt = @"Some new prompt";

I wasn't correctly accessing the navbar.

shoreline
A: 

Someone answered this for me on the Apple dev forums: UINavigationBar *bar = picker.navigationBar; UINavigationItem *navItem = bar.topItem; navItem.prompt = @"Some new prompt"; I wasn't correctly accessing the navbar.

Use the code after calling 'presentModalViewController'.....like below...

[controller presentModalViewController:imagePickerController animated:YES];

UINavigationBar *bar = picker.navigationBar; UINavigationItem *navItem = bar.topItem; navItem.prompt = @"Some new prompt";

Pawan