iPhone开发 调用摄像头进行拍照等操作
-(IBAction)addPicEvent
{
UIImagePickerControllerSourceType sourceType=UIImagePickerControllerSourceTypeCamera;
if (![UIImagePickerControllerisSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
}
UIImagePickerController * picker = [[UIImagePickerControlleralloc]init];
picker.delegate=self;
picker.allowsEditing=YES;
picker.sourceType=sourceType;
[selfpresentModalViewController:picker animated:YES];
}
-(void)saveImage:(UIImage*)image
{
NSLog(@"保存");
}
-(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[picker dismissModalViewControllerAnimated:YES];
UIImage * image=[info objectForKey:UIImagePickerControllerEditedImage];
[selfperformSelector:@selector(saveImage:) withObject:image afterDelay:0.5];
}
-(void)imagePickerControllerDIdCancel:(UIImagePickerController*)picker
{
[picker dismissModalViewControllerAnimated:YES];
}
摘自 凡娃软件
相关新闻>>
- 发表评论
-
- 最新评论 更多>>