Question: I have button which when I click displays the camera (works perfectly) 

```
- (IBAction)getPhoto:(id)sender
{
    NSLog( @"Button clicked!" );
    imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.delegate = self;

    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
        [imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
    }

    else {  // IF the device doesn't have a camera, so use the photos album
        [imagePicker setSourceType:UIImagePickerControllerSourceTypeSavedPhotosAlbum];
    }

    [self addSubview:imagePicker.view];
}

```

After which I can take an image, etc, - But when I click "use" : nothing happens here is my method : the Image picker does not dismiss itslelf : the application simply does nothing, I'm trying to take the image I just took and display it inside a CGRect on screen .

```
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [picker dismissViewControllerAnimated:YES completion:NULL];

    UIImageView *patientImage = [[UIImageView alloc] init];
    patientImage.frame = CGRectMake(625, 25, 83, 103);

    UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
    self.patientImage.image = chosenImage;
}

```

Even when I hit the cancel button without taking an image, the imagePicker (camera interface) does not dismiss itself 

Any help, advice, or guidance would be very appreciated.

Answer: 
Instead of adding the picker as a subview, you should add the picker to a `UIPopoverController`. 

You can then display it from within your `UIView` subclass by using the `presentPopoverFromRect:inView:permittedArrowDirections:animated:` popover method like this:

```
self.popover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[self.popover presentPopoverFromRect:sender.frame inView:self permittedArrowDirections: UIPopoverArrowDirectionAny animated:YES];

```

Then, you can use the delegate methods to dismiss the popover using:

```
[self.popover dismissPopoverAnimatedYES];

```

The is required by the [official docs](http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html):

> 
> The table indicates that on iPad, if you specify a source type of `UIImagePickerControllerSourceTypePhotoLibrary` or
>  `UIImagePickerControllerSourceTypeSavedPhotosAlbum`, you must present
>  the image picker using a popover controller, as described in
>  “Presenting and Dismissing the Popover” in UIPopoverController Class
>  Reference. If you attempt to present an image picker modally
>  (full-screen) for choosing among saved pictures and movies, the system
>  raises an exception. 
> 
> 
> On iPad, if you specify a source type of
>  `UIImagePickerControllerSourceTypeCamera`, you can present the image
>  picker modally (full-screen) or by using a popover. However, Apple
>  recommends that you present the camera interface only full-screen.
> 
> 
>
Try: 

```
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [picker.view removeFromSuperview];

    UIImageView *patientImage = [[UIImageView alloc] init];
    patientImage.frame = CGRectMake(625, 25, 83, 103);

    UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
    self.patientImage.image = chosenImage;
}

```