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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:52:19+00:00 2026-05-31T07:52:19+00:00

What I want to do is create a Popup with a UIImagePickerController. This parts

  • 0

What I want to do is create a Popup with a UIImagePickerController. This parts easy but I want to create a utility method that generates the UIImagePickerController popup and returns the UIImage once the user selects it. The problem is that the UIImagePickerController has a delegate property that is used for asynchronous completion. My thought was that maybe I could pass in a delegate to my utility function that contains the code to execute once the image is selected but the code to execute needs to operate on the image that was selected. This is the code I have so far and just so everyone knows, it crashes. I believe it’s because I’m executing it in a static method.

  namespace GalleryProto
{
    static public class CameraUtility
    {       
        public static void GetImageFromGalleryWithPopup(UIViewController parentViewController, PointF centerPoint)
        {
            UIImagePickerController imagePicker;
            UIPopoverController popOver;

            imagePicker = new UIImagePickerController ();
            popOver = new UIPopoverController (imagePicker);

            popOver.DidDismiss += (popOverController, e) => 
            {
                if (popOver != null && popOver.PopoverVisible) {
                    Console.WriteLine ("Popover Dismissed.");
                    popOver.Dismiss (true);
                    imagePicker.Dispose ();
                    popOver.Dispose ();
                    imagePicker = null;
                    popOver = null;
                } 
            };

            Console.WriteLine ("Before Finished Picking Image Delegate.");
            imagePicker.Delegate = new MyPickerDelegate (imagePicker, popOver);
            imagePicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
            imagePicker.AllowsEditing = false;              
            imagePicker.MediaTypes = new string[] {"public.image"};


            RectangleF popRectangle = new RectangleF (centerPoint, new SizeF (1, 1));
            popOver.PresentFromRect (popRectangle, parentViewController.View, 0, true); //Center the popup on the Image Content View.
        }

        public class MyPickerDelegate : UIImagePickerControllerDelegate
        {
            UIImagePickerController _imagePicker;
            UIPopoverController _popOver;

            public MyPickerDelegate(UIImagePickerController imagePicker, UIPopoverController popOver)
            {
                _imagePicker = imagePicker;
                _popOver = popOver;             
            }

            public override void Canceled (UIImagePickerController picker)
            {
                Console.WriteLine("Canceleled");
            }

            public override void FinishedPickingImage (UIImagePickerController picker, UIImage image, NSDictionary editingInfo)
            {
                Console.WriteLine("Finished Picking Image");

                _popOver.Dismiss (true);
                _imagePicker.Dispose ();
                _popOver.Dispose ();
                _imagePicker = null;
                _popOver = null;                
            }           
        }       
    }   
}
  • 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-31T07:52:21+00:00Added an answer on May 31, 2026 at 7:52 am

    I solved my issue by passing in a delegate for the callback that takes a UIImage as an argument so that the image can be manipulated appropriately once it’s selected.

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

Sidebar

Related Questions

I want to create an overlay that I will use behind a popup. But
I create a popup based on this post but i want to create it
I want to create a popup which is easy, but here's thing, I want
I want create a pdf using iText. The method which does this is a
Any idea why this doesn't create an activity that looks like a popup instead
I have a popup I want to create that will have 3 choices. (Block,
I want to create a popup that displays itself aligned to the right side
i m developing an application.. i want to create a popup message that will
I want to create a popup that will have a defined size like the
I am not sure how I'd do this but I want to create a

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.