我目前正在开发一个应用程序,我需要能够按下按钮打开相机,并拍摄快照,我将附加到.json文件并发送到我的服务器。我在谷歌和StackOverflow上搜索了几个小时,但所有的教程似乎都很旧(08'-09')或不符合我的需求。我知道所有的工作都是用UIImagePickerController
类完成的,但我想有一个有效的例子。有没有人知道一个好的教程来开始做这样的事情?
发布于 2012-07-04 20:21:48
好吧,如果你用谷歌搜索一下:
UIImagePickerController和拍摄快照放入json并发送到服务器
会有点难。因此,请使用UIImagePickerController
的this教程。顺便说一下,搜索的术语是:
UIImagePickerController教程2012
发布于 2013-10-07 17:58:30
您应该查看来自AppCoda Build a Simple iPhone Camera App的这篇文章,非常清楚和简单:)
使用原生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];
}
发布于 2014-09-14 20:08:28
我偶然发现了这段代码AQPhotoPicker。这是非常容易使用,只需一个调用,您将获得照片从相机或photoPicker
https://stackoverflow.com/questions/11328909
复制相似问题