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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:31:37+00:00 2026-06-10T08:31:37+00:00

I have an universal app for both iPhone and iPad. Using below code I

  • 0

I have an universal app for both iPhone and iPad. Using below code I am trying to get the picture from photo library or from camera. For iphone its working fine but for iPad it does not show anything when I click on any button from the alert view. What can be the issue?

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {

    if (buttonIndex == 0) {
        UIImagePickerController* picker = [[UIImagePickerController alloc] init];
        picker.allowsEditing = YES;
        picker.delegate   = self;
        camera = NO;
        picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

        [self presentModalViewController:picker animated:YES];


    } else if (buttonIndex == 1) {

        BOOL hasCamera = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
        camera = YES;
        UIImagePickerController* picker = [[UIImagePickerController alloc] init];
        picker.allowsEditing = YES;
        picker.delegate   = self;
        picker.sourceType = hasCamera ? UIImagePickerControllerSourceTypeCamera : UIImagePickerControllerSourceTypePhotoLibrary;

        [self presentModalViewController:picker animated:YES];

        }
    }else {
    // We are using an iPad
    UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.delegate = self;
    popoverController=[[UIPopoverController alloc] initWithContentViewController:imagePickerController];
    popoverController.delegate=self;
    [popoverController presentPopoverFromRect:[self.view bounds] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    }

}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

    if (clickedButton == YES) {

            UIImage *originalImage, *editedImage;

            editedImage = (UIImage *) [info objectForKey: UIImagePickerControllerEditedImage];

            originalImage = (UIImage *) [info objectForKey: UIImagePickerControllerOriginalImage];

            if (editedImage) {

                thisImage = editedImage;

            } else {

                thisImage = originalImage;

            }

            imageThis.image = thisImage;

        NSData *imageData = UIImageJPEGRepresentation(thisImage, 30);

        [defaults setObject:imageData forKey:@"thisImage"];

        [defaults synchronize];

     //   [[NSUserDefaults standardUserDefaults] setObject:UIImagePNGRepresentation(thisImage) forKey:@"thisImage"];

    }
    else {

        UIImage *originalImage, *editedImage;

        editedImage = (UIImage *) [info objectForKey: UIImagePickerControllerEditedImage];

        originalImage = (UIImage *) [info objectForKey: UIImagePickerControllerOriginalImage];

        if (editedImage) {

            thatImage = editedImage;

        } else {

            thatImage = originalImage;

        }

        imageThat.image = thatImage;

        NSData *imageData = UIImageJPEGRepresentation(thatImage, 30);

        [defaults setObject:imageData forKey:@"thatImage"];

        [defaults synchronize];

        //[[NSUserDefaults standardUserDefaults] setObject:UIImagePNGRepresentation(thatImage) forKey:@"thatImage"];

    }

    [picker dismissModalViewControllerAnimated:YES];
}
  • 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-10T08:31:39+00:00Added an answer on June 10, 2026 at 8:31 am

    It’s this line:

    [popoverController presentPopoverFromRect:[self.view bounds] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    

    You need to present from a rectangle that is within your controller’s view (I’m assuming that self is a view controller), or else you get weird results. In testing just now, I had one popover refuse to appear and one that appeared with the tip of its arrow centered on screen. So for instance:

    [popoverController presentPopoverFromRect:[myButtonOutlet frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a universal app (runs on both iPhone & iPad), how do
I have a Core Data app that will end up being an iPhone/iPad universal
I have a universal app and for each device (iPad, iPhone) have different sets
I have a universal app, and on the iPad version I'm using UISplitViewController to
I have a universal app which I decided should become iPad only from the
I have a Universal app (iPhone/iPad) which has an iAd displayed at the bottom
I have a Universal app (iPhone/iPad) testing on IOS4.3. It has an iAd which
I have a Universal app (iPhone/iPad) which is very basic. There is a List
Im making a universal app for iPhone and iPad, both retina and non retina
I have written a universal app that's working fine on both iPhone (iPod Touch)

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.