ios - 如何响应 UIImagePickerController 生成的 UIAlertView

标签 ios uiimagepickercontroller uialertview

我正在使用 UIImagePickerController 从我的应用中捕获视频,并且我已将视频最长持续时间设置为 30 秒。当达到 30 秒限制时。我收到一条警告消息“达到最大视频录制限制”由 UIImagePickerController 生成,它停止捕获视频。

我想要的是在达到 30 秒限制时响应自动生成的警报。当按下该警报的“确定”按钮时,我想执行一些操作。我已经实现了 UIAlertView 的所有委托(delegate)方法,但是当我按下 OK 按钮时它确实以任何方法出现。

请帮助我如何响应该警报?

最佳答案

你不能使用所有这些委托(delegate)方法,因为你没有启动 UIAlertView 所以你不能设置他的委托(delegate)...

我唯一能想到的就是做一些事情,比如听 UIWindowDidBecomeVisibleNotification 来检测警报何时显示,以及 UIWindowDidBecomeHiddenNotification 通知来检测它何时消失.

你应该知道这些通知会为所有使用它们自己的 UIWindow 的组件触发,例如 UIActionSheet 或键盘,所以你需要确保这是正确的(也许检查其中一个 subview 中是否有 UIAlertView..)

关于ios - 如何响应 UIImagePickerController 生成的 UIAlertView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17541790/

相关文章:

ios - 比较 Objective C 中的 NSString

ios - 用 AFNetworking 替换 NSURLConnection

ios - 无法更改 UIImagePickerController 的 cameraFlashMode

ios - ios 6 中带有文本字段和三个按钮问题的 UIAlertView

ios - 多次调用 block 显示 View 中的 UIAlertView

ios - 屏幕方向和旋转的奇怪行为(横向不是 1024、748)?

iOS9 在后台不跟踪位置

iOS UIImagePickerController : Any way of getting the date of the chosen Picture?

ios - UIImagePickerController 在 iOS 9 上不请求权限

ios - 带有渐进式 UIAlertView 的 AFNetworking 下载