i am creating an application which capture an image form iphone camera and display it in the created application i read some articles in ios developer library and written this code in .m file
- (BOOL) startCameraControllerFromViewController: (UIViewController*) controller
usingDelegate: (id <UIImagePickerControllerDelegate,
UINavigationControllerDelegate>) delegate {
if (([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeCamera] == NO)
|| (delegate == nil)
|| (controller == nil))
return NO;
UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;
// Displays a control that allows the user to choose picture or
// movie capture, if both are available:
cameraUI.mediaTypes =
[UIImagePickerController availableMediaTypesForSourceType:
UIImagePickerControllerSourceTypeCamera];
// Hides the controls for moving & scaling pictures, or for
// trimming movies. To instead show the controls, use YES.
cameraUI.allowsEditing = NO;
cameraUI.delegate = delegate;
[controller presentModalViewController: cameraUI animated: YES];
return YES;
}
also created a button that is linked with this code,
It call this function but the control does not passes to the above function
- (IBAction) showCameraUI {
[self startCameraControllerFromViewController: self
usingDelegate: self];
}
And i also have no idea that this code will work or not
Do some one have any better idea.
Thanks,
Arun.
First assign delegate to it’s source file
Then when you pressed your button implement this method open camera controller in your app
First of all create PopOverController for iPad because we cannot directly open ImagePicker Controller
EDIT: Added UIPopOverController
And implement this delegate method for get the captured image
Implement this method if user cancel the controller