-(IBAction) camAction
{
if([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeCamera]){
UIImagePickerController *picker=[[UIImagePickerController alloc] init];
picker.delegate=self;
picker.sourceType=UIImagePickerControllerSourceTypeCamera;
//picker.allowsImageEditing = YES;
picker.editing=YES;
[self presentModalViewController:picker animated:YES];
[picker release];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"This device does not have any camera."
delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
[alert show];
[alert release];
}
}
-(IBAction) libraryAction
{
if([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypePhotoLibrary]){
UIImagePickerController *picker=[[UIImagePickerController alloc] init];
picker.delegate=self;
picker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
//picker.allowsImageEditing = YES;
picker.editing=YES;
[self presentModalViewController:picker animated:YES];
[picker release];
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment