我正在寻找一个教程,我可以使用我的iPhone拍照并将其保存在手机上。我用Google搜索了这个,但是无法找到任何教程或示例代码。有人可以通过指出教程或示例代码来帮助我吗?
答案 0 :(得分:3)
看看UIImagePickerController
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html
答案 1 :(得分:2)
答案 2 :(得分:1)
UIPicker.sourceType=UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:UIPicker animated:YES];
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
//code to save image in gallary
UIImageWriteToSavedPhotosAlbum(receivedImage, nil,nil, nil);
//close the picker
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
//close the picker
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
}