Note that there are some explanatory texts on larger screens.

plurals
  1. POShowing UIImagePickerController in UIPopoverController with existing UINavigationController (adding back button)
    primarykey
    data
    text
    <p>So I have a <code>UIPopoverController</code> what houses my <code>UINavigationController</code> where I have my <code>UITableViewController</code> however one of my options on the <code>UITableView</code> is to go and select an image with the <code>UIImagePickerController</code>... Now on the iPhone I can simply use <code>presentModalViewController:animated:</code> however calling that from within a UIPopoverController causes a crash so thats not possible...</p> <p>I also know the <code>UIImagePickerController</code> needs its own <code>UINavigationController</code> so I can't just push <code>pushViewController:animated:</code> either...</p> <p>So I figured out that if I keep a link to the <code>UIPopoverController</code> I created, I can then use <code>setContentViewController:animated:</code> to switch to the UIImagePickerController's viewController... </p> <p>However, I am now stuck at giving the user a way to go back to the previous <code>UINavigationController</code> as I need to be able to add a cancel button to the <code>UIImagePickerController</code> but when I try to do this the cancel button won't get added...</p> <p>Heres my code that i'm using</p> <pre><code>-(void)doPhotoalbums { if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) { UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; [imagePicker setDelegate:self]; [imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; [imagePicker setContentSizeForViewInPopover:CGSizeMake(320, 480)]; UIBarButtonItem *cancel = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:nil]; [imagePicker.navigationItem setLeftBarButtonItem:cancel]; //[self presentModalViewController:imagePicker animated:YES]; [[self parentPopoverController] setContentViewController:imagePicker animated:YES]; } else { [UIAlertView showMessage:@"This device does not have any photo albums."]; } } </code></pre> <p>So my question is.. Does anybody know how I can get around this? either by adding a cancel/back button what I can hook up to make the navigationControllers switch back or another way to present this (i'd like to avoid switching between two UIPopoverControllers but I don't know what else I can do..</p> <p>Thanks</p> <p>Liam</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload