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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:35:59+00:00 2026-05-31T05:35:59+00:00

Currently, my app loads a UIImagePickerController when a button is pressed. I would like

  • 0

Currently, my app loads a UIImagePickerController when a button is pressed. I would like to get rid of the button and have it load automatically when the view loads and then have the app close after an image is selected.

This is the method I have been using for when the button is clicked.

-(BOOL)startMediaBrowserFromViewController:(UIViewController *)controller usingDelegate:(id<UIImagePickerControllerDelegate,UINavigationControllerDelegate>)delegate
{
if(([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum] == NO)
   || (delegate == nil)
   || (controller == nil))
    return NO;
UIImagePickerController *mediaUI = [[UIImagePickerController alloc] init];
mediaUI.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeSavedPhotosAlbum];
mediaUI.allowsEditing = YES;
mediaUI.delegate = delegate;

[controller presentModalViewController:mediaUI animated: YES];
return YES;
}

I figured I could just call this method in the loadView method. I tried three ways. First, the obvious one.

[self startMediaBrowserFromViewController:self usingDelegate:self]

That didn’t work, but still returned YES which I found odd.

Next, I called the method that is used when the button is clicked.

[self btnShowClicked:nil]

No luck there either. Finally, I tried one that I thought would have to work, since it would be simulating a touch on the button (if I understand it correctly)

[self.btnShow sendActionsForControlEvents:UIControlEventTouchUpInside];

Still no luck and I’m out of ideas.

Does anyone know of a way to do this? I don’t think it should be that difficult.

  • 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-05-31T05:36:00+00:00Added an answer on May 31, 2026 at 5:36 am

    Add your code (any of the three methods you tried – the first looks fine) to your viewDidAppear method instead of in loadView. Make sure to also call [super viewDidAppear] first.

    The problem relies on [controller presentModalViewController:mediaUI animated: YES]; being called after everything is set up properly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a simple iPhone app that loads a custom subclass of UIView.
I currently have this workflow in a tab based app: Tab1 loads... ViewOne :
My app has UIWebView that loads a document with links. I would like to
I have a code that currently loads a NIB file like below : Login
I have an app that loads while a 2 second movie plays. Currently the
I have an internal enterprise app that currently consumes 10 different web services. They're
We have an app that currently installs itself into 'program files\our app', and it
I have a web app that currently is inserting x (between 1 + 40)
Currently I have an app with a virtual currency. I want to be able
I have an app that loads records from a binary log file and displays

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.