How to detect if voice dictation was used for UITextField? Or microphone button was tapped on keyboard. Is there any way to do that?
UITextField conforms to UITextInput Protocol ( under the section Using Dictation are methods of interest). In this protocol is a method dictationRecordingDidEnd that you can override.
One way is to subclass UITextField and implement the above mentioned method and any others of interest from the UITextInput protocol.
example subclass .h
#import <UIKit/UIKit.h>
@interface BWDictationTextField : UITextField
@end
.m
#import "BWDictationTextField.h"
@implementation BWDictationTextField
- (void)dictationRecordingDidEnd {
NSLog(@"%s", __PRETTY_FUNCTION__);
}// done is pressed by user after dictation
@end
Unfortunately there is no documented way to detect the actual tap of the microphone button ( dictation did start ).