0

How to add the UIImagePickerController in the view ? If I add the image picker to the view, its show on the full screen. I need to show the on the centre of the view, But UIImagePickerController hide the navigation bar.

How add the UIImagePickerController in the view and also show the navigation bar ?

I am using the following code, I got the output like this(screenshot).

imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
imagePicker.showsCameraControls     = NO;
imagePicker.navigationBarHidden     = NO;
imagePicker.toolbarHidden           = YES;
imagePicker.wantsFullScreenLayout   = NO;
imagePicker.delegate                = self;
imagePicker.cameraOverlayView       = cameraOverlayView;
[self presentViewController:imagePicker animated:NO completion:nil];

I need some for show the navigation bar while add the UIImagePickerController in the view. Thanks in advance.enter image description here

Mani
  • 1,310
  • 1
  • 20
  • 40

2 Answers2

1

If you are develop application for iPad then you can use popoverviewcontroller to show imagepickerviewcontroller with navigation bar

please see thie link :

How to use UIImagePickerController in iPad?

Community
  • 1
  • 1
Abhishek Gupta
  • 601
  • 5
  • 16
  • No, My application only for the iPhone. so I need to add UIImagePickerController in the view. as well as show the navigation bar on the view. – Mani Nov 18 '13 at 12:39
1

Correct way to customize media capture here using Assets Library.

Simple way (in some cases) is using overlay view with frame size of whole screen and add controls on that view which simulate navigation bar.

    if (_pickerOverlay == nil) {
    _pickerOverlay = [[UIView alloc] initWithFrame:self.view.bounds];
    //red transparent tint for demo
    _pickerOverlay.backgroundColor = [UIColor colorWithRed:1.0
                                                     green:0.0
                                                      blue:0.0 alpha:0.6];

    UIButton *btnBack = [UIButton buttonWithType:UIButtonTypeSystem];
    btnBack.frame = CGRectMake(20, 20, 250, 40);
    [btnBack setTitle:@"Custom buttom" forState:UIControlStateNormal];
    btnBack.backgroundColor = [UIColor whiteColor];
    [_pickerOverlay addSubview:btnBack];
}

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.showsCameraControls = NO;
picker.cameraOverlayView = _pickerOverlay;

[self presentViewController:picker animated:YES completion:nil];
Ilia
  • 1,434
  • 15
  • 22
  • Thank you. I need, how can I set the frame for the cameraOverlayView ? Because the camera view start from top edge(no navigation, status bar). I don't want like this, I need how to show navigation bar with cameraOverlayView ? Please give your suggestions. – Mani Nov 19 '13 at 06:43
  • @Mani In your case you should create custom view controller and get media capture features with AV Foundation Library. Docs [here](https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/04_MediaCapture.html#//apple_ref/doc/uid/TP40010188-CH5-SW2) – Ilia Nov 20 '13 at 05:48