UIImagePickerController问题
我在 UIImagePickerController
中遇到了一个相当奇怪的错误。 (或者我做错了什么)
我这样加载控制器:
UIImagePickerController*controller = [[UIImagePickerController alloc] init];
controller.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[controller setDelegate:self];
[firstView presentModalViewController:controller animated:YES];
现在问题如下:代码运行良好,但只能运行一次。它作为一个操作与 UIButton
绑定在一起 - 如果我第二次单击它而不是 UIImagePickerController
我会看到一个半透明(alpha 0.8ish?)黑色视图出现,我不能驳回。
我在任何地方都没有创建这样的视图,只有该操作中的 UIImagePickerController 。
我在委托中驳回了它:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
[firstView dismissModalViewControllerAnimated:YES];
[picker release];
}
这也能正常工作。
我做错了什么/这是一个错误吗?
I've come across a rather weird bug in UIImagePickerController
. (or I'm doing something wrong)
I load the controller as such:
UIImagePickerController*controller = [[UIImagePickerController alloc] init];
controller.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[controller setDelegate:self];
[firstView presentModalViewController:controller animated:YES];
Now the problem is the following: The code works great, but only once. It's tied to an UIButton
as an action - if I click it the second time instead of the UIImagePickerController
I get a translucent (alpha 0.8ish?) black view appearing, which I can't dismiss.
I create no such view anywhere, it's only the UIImagePickerController
that is in that action.
I dismiss it in the delegate:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
[firstView dismissModalViewControllerAnimated:YES];
[picker release];
}
and this works as it should as well.
What am I doing wrong / is this a bug?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信你想要做的是在呈现之后释放控制器:
而不是在完成之后:
presentModalViewController将在持续时间内保留控制器并适当地释放它。
I believe what you want to do is release the controller after the present:
And not in the did finish:
The
presentModalViewController
will retain the controller for the duration and release it appropriately.