I am using UIImagePickerController to capture video from my app and i have set video maximum duration to 30 seconds. When that 30 seconds limit is reached. I get an alert with a message "maximum video recording limit reached" produced by UIImagePickerController and it stops capturing video.
What I want is that I want to respond to that alert that is generated automatically when 30 seconds limit is reached. I want to perform some action when "OK" button of that alert is pressed. I have implemented all the delegate methods of UIAlertView but it does come in any method when I press OK button.
Please help me how I can respond to that alert?
You can't use all those delegate methods because you didn't initiate the
UIAlertView
so you can't set his delegate...The only thing I can think about is to do somethong like listening to the
UIWindowDidBecomeVisibleNotification
to detect when an alert is shown and to theUIWindowDidBecomeHiddenNotification
notification to detect when it disappears.You should know that those notification will fire for all kind of components that uses their own
UIWindow
such asUIActionSheet
or the keyboard, so you need to make sure this is the right one (maybe check to see if there is a UIAlertView in one of the subviews..)Set yourself as a delegate of your
UIImagePickerController
, and implement the UIImagePickerControllerDelegate protocol. Specifically, the following method:Use UIAlertViewDelegateProtocol
Form docs
Please refer this tutorials : http://mobile.tutsplus.com/tutorials/iphone/uialertview/ you can get more ideal about this :