【发布时间】:2013-01-23 13:39:50
【问题描述】:
我正在使用 UIImagePickerViewController 从我的应用程序中的 iPhone 默认相机拍摄照片并将其存储在 Document 目录中。完成这个过程需要很长时间,而且它在 tableview 上的显示速度也很慢。在这里调整图像大小有帮助吗?
-(IBAction)takePhoto:(id)sender
{
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera])
{
imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:imgPicker animated:YES];
}
}
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *pickedImage = [info objectForKey:UIImagePickerControllerOriginalImage];
[self dismissModalViewControllerAnimated:YES];
NSData *imageData = UIImagePNGRepresentation(pickedImage);
NSString *path = [SAVEDIMAGE_DIR stringByAppendingPathComponent:@"image.png"];
[imageData writeToFile:path atomically:YES];
}
【问题讨论】:
标签: iphone xcode uiimagepickercontroller