在 iOS 5 中将 PresentViewController 与 UIImagePickerController 结合使用时,取消按钮显示为禁用状态
当图像选择器控制器首先出现时,“取消”按钮显示为禁用状态并且不起作用,但是当我通过选择相册移动到下一个视图时,“取消”按钮变为启用状态并开始正常工作。
我应该怎样做才能保持“取消”按钮启用并始终有效?
imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
NSArray *sourceTypes = [UIImagePickerController availableMediaTypesForSourceType:imgPicker.sourceType];
imgPicker.mediaTypes = sourceTypes;
[self presentViewController:imgPicker animated:YES completion:Nil];
}
The Cancel button appears disabled and doesn't work when the image picker controller appears first, but as I move to the next view by selecting an album, the Cancel button becomes enabled and starts working fine.
What should I do to keep the Cancel button enabled and working all the time?
imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
NSArray *sourceTypes = [UIImagePickerController availableMediaTypesForSourceType:imgPicker.sourceType];
imgPicker.mediaTypes = sourceTypes;
[self presentViewController:imgPicker animated:YES completion:Nil];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你在
UIImagePickerControllerDelegate
中实现了这个功能吗?更多参考
Have you implement this function in
UIImagePickerControllerDelegate
?More reference