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 9201095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:55:21+00:00 2026-06-17T22:55:21+00:00

On my app I have a cameraOverlayView over my open camera with custom controls

  • 0

On my app I have a cameraOverlayView over my open camera with custom controls for the camera buttons. The app allows the user to take several pictures before closing the camera, so the shutter button does not call dismissViewControllerAnimated, instead there’s a close button for when you’re done taking pictures.

Now, one of the buttons on the camera overlay is a gallery button to allow the user to pick a saved image instead of shooting a new one. I’ve tried two different approaches to make this work, both failed.

First approach

Use the same UIImagePickerController instance that is currently presenting the overlay and switch the sourceType to library. It does present the gallery then, but when a photo is tapped, I can’t dismiss the galley without dismissing the whole overlay.

Second approach

Create a separate instance of UIImagePickerController, set the sourceType to gallery and attempt to call presentViewController, which then fails with the warning:

“Warning: Attempt to present on
whose view is not in the window
hierarchy!”

Does anyone have a solution for this issue? Is this even possible?

  • 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-17T22:55:23+00:00Added an answer on June 17, 2026 at 10:55 pm

    Try this~~ I think it is your goal.

    #import "ViewController.h"
    
    @interface ViewController ()
    
    @property (nonatomic, strong) UIImagePickerController *imagePicker;
    
    @end
    
    @implementation ViewController
    
    @synthesize imagePicker = _imagePicker;
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.
    
    }
    
    
    - (void)viewDidAppear:(BOOL)animated
    {
        [super viewDidAppear:YES];
    
        sleep(2);
    
        _imagePicker = [[UIImagePickerController alloc] init];
        [_imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
        [_imagePicker setDelegate:self];
    
        UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(10, 50, 100, 30)];
        [button setTitle:@"Library" forState:UIControlStateNormal];
        [button setBackgroundColor:[UIColor darkGrayColor]];
        [button addTarget:self action:@selector(gotoLibrary:) forControlEvents:UIControlEventTouchUpInside];
    
        [_imagePicker.view addSubview:button];
    
        [self presentViewController:_imagePicker animated:YES completion:nil];
    }
    - (void)didReceiveMemoryWarning
    {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }
    
    -(IBAction)gotoLibrary:(id)sender
    {
        UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
        [imagePicker.view setFrame:CGRectMake(0, 80, 320, 350)];
        [imagePicker setSourceType:UIImagePickerControllerSourceTypeSavedPhotosAlbum];
        [imagePicker setDelegate:self];
    
        [_imagePicker presentViewController:imagePicker animated:YES completion:nil];
    }
    
    
    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
    {
        [picker dismissViewControllerAnimated:YES completion:nil];
    }
    - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
    {
        [picker dismissViewControllerAnimated:YES completion:nil];
    }
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an app for iPad2 which allows user to take photos. I
I have an app that loads the camera and overlays buttons for fire, reload,
my app have action bar on top of windows. Where are some buttons. Buttons
How can I make a BlackBerry app have an icon but when a user
In my iOS app have a UITableView which contains a custom subview in one
Previous versions of my app have used the Settings.bundle method to have some user
My app have Preferences window. I open it using this code - (IBAction)openPreferences:(id)sender {
Possible Duplicate: Open Facebook page from Android app? Does the Android Facebook app have
I have an Ipad app what has multiple OpenGL tile images, couple buttons in
My app have a background image that fills the screen. I'd like to display

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.