Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7887905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:42:05+00:00 2026-06-03T05:42:05+00:00

So I have a UIPopoverController what houses my UINavigationController where I have my UITableViewController

  • 0

So I have a UIPopoverController what houses my UINavigationController where I have my UITableViewController however one of my options on the UITableView is to go and select an image with the UIImagePickerController… Now on the iPhone I can simply use presentModalViewController:animated: however calling that from within a UIPopoverController causes a crash so thats not possible…

I also know the UIImagePickerController needs its own UINavigationController so I can’t just push pushViewController:animated: either…

So I figured out that if I keep a link to the UIPopoverController I created, I can then use setContentViewController:animated: to switch to the UIImagePickerController’s viewController…

However, I am now stuck at giving the user a way to go back to the previous UINavigationController as I need to be able to add a cancel button to the UIImagePickerController but when I try to do this the cancel button won’t get added…

Heres my code that i’m using

-(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."];
    }
}

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..

Thanks

Liam

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T05:42:06+00:00Added an answer on June 3, 2026 at 5:42 am

    Ahh.. after a little break I found this: https://discussions.apple.com/thread/1710435?start=0&tstart=0

    using the UINavigationControllerDelegate you can use the navigationController:willShowViewController:animated: method to access the navigationBar.. then with some code (below) you can add a button.

    if ([navigationController isKindOfClass:[UIImagePickerController class]]) {
    
        UINavigationBar *bar = navigationController.navigationBar;
        UINavigationItem *top = bar.topItem;
    
        UIBarButtonItem *cancel = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(imagePickerControllerDidCancel:)];
        [top setLeftBarButtonItem:cancel];
    
    } else { 
    
        //do non imagePickerController things 
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIPopOverController that shows a UIViewController with a UITableview in its view.
I have some UIPopoverController that were working fine in 4.3/5.0 iOS iPad. Now, with
I have a UIViewController that has an UIPopoverController that has an UINavigationController then a
I have a UITableView which I present in a UIPopoverController . The table view
I have a UIPopoverController which displays a UItableview. I use the PresentFromBarButtonItem method. How
I have a UITabBarController inside a UIPopoverController, which I am displaying solely from one
I have one delegate file, one View Controller and one UIPopoverController My PopoverController is
I have a UITableView in a UINavigationController. On the navigation bar I have a
I have a UIPopoverController with a subclass UINavigationController. Both the parent and child views
In iOS 4, I have a UIPopoverController that opens a UITableViewController with a long

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.