如何在iPhone中访问相机以及如何将图片保存到自定义相册。

时间:2012-09-06 09:00:22

标签: iphone ios5 uiimagepickercontroller

我是iOS新手,我想访问相机拍照。并将这些图片保存到自定义照片库中。通过谷歌搜索我得到了我想要使用UIImagePickerControllerAVFoundation Framework.How我可以使用{{1访问相机并将图片保存到自定义照片库中}}

1 个答案:

答案 0 :(得分:0)

-(IBAction)camaraBtnPress:(id)sender
{
    imagePickerController = [[UIImagePickerController alloc]init];
    imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
    imagePickerController.delegate = self;
    [self presentModalViewController:imagePickerController animated:YES];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    [imagePickerController dismissModalViewControllerAnimated:YES];
}

- (void)imagePickerController:(UIImagePickerController *)picker
        didFinishPickingImage:(UIImage *)image
                  editingInfo:(NSDictionary *)editingInfo
{
    [imagePickerController dismissModalViewControllerAnimated:YES];

    //to save in library
    UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
}

按照此link将照片保存在自定义相册