Note that there are some explanatory texts on larger screens.

plurals
  1. POdismissViewControllerAnimated mysteriously working for iPhone
    primarykey
    data
    text
    <p>So I have an iPhone app that picks and image and then a popover comes up. You can can choose to cancel the popover which dismisses the popover and is what the following method does. When I test my app I can pick an image from the photo library, have the image picker be dismissed, but then the imagePicker comes back up. However, when I test my app, the following method's comment's are not being printed and I didn't implement a dimiss call elsewhere so how is it possible that this is happening???</p> <pre><code>- (void) imagePickerControllerDidCancel:(UIImagePickerController *)picker { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ) { if ([popoverController isPopoverVisible]) { NSLog(@"imagePickerControllerDidCancel called for iPad"); [popoverController dismissPopoverAnimated:YES]; } } else { NSLog(@"imagePickerControllerDidCancel called for iPhone"); [self dismissViewControllerAnimated:YES completion:nil]; } [picker release]; [self pickImage]; } </code></pre> <p>Code used to present the view controller:</p> <pre><code>switch (buttonIndex) { case 0: { //photo library if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) { UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ) { if ([popoverController isPopoverVisible]) { [popoverController dismissPopoverAnimated:YES]; } else { popoverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker]; popoverController.delegate = self; [popoverController presentPopoverFromRect:CGRectMake( 250, -50, 320, 480 ) inView:[self view] permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; } } else { [self presentViewController:imagePicker animated:TRUE completion:nil]; } } else { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Photo library is empty or unavailable" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; } break; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload