我正在使用 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];
}