【发布时间】:2013-04-04 05:00:58
【问题描述】:
我正在使用图像选择器从照片库中选择照片。当我单击按钮时,它会显示照片库。但是当我单击特定图像时,它会关闭 modalView 并且图像不会加载到查看。
代码:
-(void)showcamera:(id)sender{
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc]init];
imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:imagePickerController animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)image
editingInfo:(NSDictionary *)editingInfo
{
// Dismiss the image selection, hide the picker and
//show the image view with the picked image
[picker dismissModalViewControllerAnimated:YES];
UIImage *newImage = image;
}
【问题讨论】:
-
我认为它的 bcoz 您在关闭选择器后设置 newImage。这是我的意见。您还必须初始化图像。
-
为什么还要初始化两次imagePickerController?
-
当我使用 imagePickerController.allowsEditing=YES;编码工作完美。谢谢大家
-
当我使用 imagePickerController.allowsEditing=YES;矩形框和导航栏内显示的图像,带有选择、取消按钮。我不要盒子。如何取消?
标签: iphone objective-c uiview uiimage uiimagepickercontroller