Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get Camera working on iPad inside UIPopoverController?
    primarykey
    data
    text
    <p>I'm trying to write iOS app that uses camera or photo library to take pictures. This is my first iOS app so I have no experience. I've found several examples how to do it for iPhone and replaced modal window call <code>presentViewController</code> with <code>IUPopoverController</code>. This works fine for photo library (<code>imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary</code>) but for camera ( <code>imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera</code> ) have the following error:</p> <pre><code>Terminating app due to uncaught exception 'NSGenericException', reason: 'The content view controller argument must be the root of its associated view controller hierarchy.' </code></pre> <p>using Xcode 4.6 test for iOS 6.1</p> <p>My code:</p> <pre><code>- (void) useCamera:(id)sender { if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) { UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; imagePicker.mediaTypes = @[(NSString *) kUTTypeImage]; imagePicker.allowsEditing = NO; if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { _popover = [[UIPopoverController alloc] initWithContentViewController: imagePicker]; [_popover presentPopoverFromRect: _popoverCenter inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; } else { [self presentViewController:imagePicker animated:YES completion:nil]; } _newMedia = YES; } else { UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Camera failed to open" message: @"Camera is not available" delegate: nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; } } </code></pre> <p>Is it possible to show camera inside popover on iPad? Thanks. </p>
    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.
    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