I'd like to know when dictation has end (ideally also when it started).
My UIViewController
which includes the UITextView
conforms to the UITextInputDelegate
protocol.
To make it work I had to subscribe to the UITextInputCurrentInputModeDidChangeNotification
override func viewDidLoad() {
super.viewDidLoad()
NSNotificationCenter.defaultCenter().addObserver(self, selector: "changeInputMode:", name: UITextInputCurrentInputModeDidChangeNotification, object: nil)
}
and add the delegate there (it didn't work simply adding it to the viewDidLoad())
func changeInputMode(sender : NSNotification) {
textView.inputDelegate = self
}
Starting and stopping dictation the UITextInput now correctly calls the required delegate methods:
func selectionWillChange(textInput: UITextInput){ }
func selectionDidChange(textInput: UITextInput){ }
func textWillChange(textInput: UITextInput){ }
func textDidChange(textInput: UITextInput){ }
However what doesn't get called is
func dictationRecordingDidEnd() {
println("UITextInput Dictation ended")
}
Why? How can I get notified/call a method on dictation having ended?