UIImagePickerController教程?

我目前正在开发一个应用程序,我需要能够按下一个button打开相机,并拍摄快照,我将附加到.json文件并发送到我的服务器。 我在谷歌和StackOverflowsearch了几个小时,但所有的教程似乎很旧(08'-09')或不符合我的需求。 我知道所有的工作都是用UIImagePickerController类完成的,但是我想要一个工作的例子。 有没有人知道一个很好的教程来开始这样的事情?

那么如果你谷歌的东西像:

UIImagePickerController并把快照放在json中并发送到服务器

会有点困难。 所以,使用本教程的UIImagePickerController 。 顺便说一下,search的术语是:

UIImagePickerController教程2012

你应该从AppCoda检查这篇文章构build一个简单的iPhone相机应用程序 ,非常清晰和简单:)

使用本机iOS相机应用拍照

 - (IBAction)takePhoto:(UIButton *)sender { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.allowsEditing = YES; picker.sourceType = UIImagePickerControllerSourceTypeCamera; [self presentViewController:picker animated:YES completion:nil]; } 

阅读捕获的照片(你必须实现UIImagePickerControllerDelegate

 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *chosenImage = info[UIImagePickerControllerEditedImage]; self.imageView.image = chosenImage; [picker dismissViewControllerAnimated:YES completion:nil]; } 

我碰到这个代码AQPhotoPicker 。 这只是一个通话很容易使用,你会从相机或photoPicker的照片

试试这个 。 这很简单,你只需要为控制器设置委托并调用它。 谷歌会帮助你,有很多的资源和工作的例子。 例如, 来自Apple的示例代码