how to open UIImagePickerControllerSourceTypeCamera into a small popup
subview
I am trying to open a UIImagePickerControllerSourceTypeCamera into a small
popup subview, however every time I try this it simply goes to full screen
camera... This is the first time I have tried using the camera I have read
all of the docs in the developers site and I just cannot find anything
explaning how to do what I would like to do.
Below is my startCamera method, in which i create a subview, then create
the cameraView add the cameraView to the small subview then i load it onto
the main UIView.... however as said above it goes full screen everytime :(
any help making this cameraView look like a small popup view would be
greatly appreciated.
#pragma StartCamera
- (IBAction)startCamera:(id)sender {
if (isCameraViewLoaded == NO) {
// Load View for camera
cameraView = [[UIView alloc] initWithFrame:CGRectMake(100.0,
100.0, 200.0, 100.0)];
cameraView.backgroundColor = [UIColor greenColor];
// imagepicker stuff
// check for rear facing camera to continue
if( [UIImagePickerController
isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceRear])
{
// load imagePickController into subview
UIImagePickerController
*imagePickController=[[UIImagePickerController alloc]init];
imagePickController.sourceType=UIImagePickerControllerSourceTypeCamera;
imagePickController.delegate=self;
imagePickController.allowsEditing=TRUE;
imagePickController.modalPresentationStyle =
UIModalPresentationCurrentContext;
[cameraView addSubview:imagePickController.view];
}
else {
// if there is no camera on the device give warning
UIAlertView *noCameraAlert = [[UIAlertView alloc]
initWithTitle:@"Incompatible Device" message:@"Sorry, This
feature requiers a rear facing camera" delegate:self
cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[noCameraAlert show];
}
// pass camera View to mainview
[self.view addSubview:cameraView];
isCameraViewLoaded = YES;
}else{
[cameraView removeFromSuperview];
isCameraViewLoaded = NO;
}
}
No comments:
Post a Comment