1

I'm trying to add UIImagePickerController into my rootviewcontroller as a subview, so that the camera is displayed within the main app area, not as an overlay. Here is my code:

-(void)cameraSetup{
CGRect bottomBarFrame = CGRectMake(0, self.view.frame.size.height-UA_BOTTOM_BAR_HEIGHT, self.view.frame.size.width, UA_BOTTOM_BAR_HEIGHT);
self.bottomNavBar = [[BottomNavBar alloc] initWithFrame:bottomBarFrame leftIcon:UA_ICON_PHOTOLIBRARY withFrame:CGRectMake(0, 0, 45, 22.5) centerIcon:UA_ICON_TAKE_PHOTO withFrame:CGRectMake(0, 0, 90, 45)];

//create a new image picker instance
picker = [[UIImagePickerController alloc]init];
picker.delegate = self;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
    //set source to video!
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    //hide all controls
    picker.showsCameraControls = NO;
    picker.navigationBarHidden = NO;
    picker.toolbarHidden = YES;
    picker.editing = NO;
    //make the video preview full size
    //picker.wantsFullScreenLayout = YES;

    picker.cameraViewTransform = CGAffineTransformScale(picker.cameraViewTransform,1, 1);

    [picker.view addSubview:self.bottomNavBar];

    picker.view.frame=CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-(UA_TOP_WHITE+UA_TOP_WHITE-bottomBarFrame.size.height));
    [self.view addSubview:picker.view];
    [picker viewWillAppear:YES];
    [picker viewDidAppear:YES];

}else{
    UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Test Text" message:@"Camera is Not Availble" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];
    [alert show];
}
}

even though I'm setting the frame of the picker not to be full-screen it always appears full-screen. is there any way to get rid of that behavior? or is there another option to display my BottomNavBar on top of the picker?

sathiamoorthy
  • 1,488
  • 1
  • 13
  • 23
suMi
  • 1,536
  • 1
  • 17
  • 30

1 Answers1

-3

UIImagePickerController is intended for use when an application requires access to system resources, like the camera or even the users photo library. As they UIImagePickerController enables system access in a controlled manner, it is obvious you cannot customize it.

Muruganandham K
  • 5,271
  • 5
  • 34
  • 62
Rohan Bhale
  • 1,323
  • 1
  • 11
  • 29
  • thanks for the comment but there are tons of examples where it is supposedly working e.g., http://stackoverflow.com/questions/17918584/ios-uiimagepickercontroller-set-frame – suMi Feb 07 '14 at 12:51