我正在使用UITextView並在我的視圖控制器中添加了UITextInputDelegate。我已經實現了textDidChange和dictationRecordingDidEnd方法。 textDidChange和dictationRecordingDidEnd永遠不會被調用。請幫忙。dictationRecordingDidEnd從來沒有打電話
在MyViewController.h文件
@interface MyViewController : UIViewController <UITextViewDelegate, UITextInputDelegate>
{
}
在MyViewController.m文件
- (void) textDidChange:(id<UITextInput>)textInput
{
}
- (void)dictationRecordingDidEnd
{
}
- (void)dictationRecognitionFailed
{
textViewResults.text = @"Dictation Failed";
}
您是否在MyViewController中設置了文本輸入委託給自己:viewDidLoad? – onnoweb
是的,我做到了。它調用 - (void)textViewDidBeginEditing:(UITextView *)textView和 - (void)textViewDidEndEditing:(UITextView *)textView。但是從來沒有爲UITextInputDelegate調用任何委託方法(如 - (void)textDidChange:(id)textInput, - (void)dictationRecordingDidEnd, - (void)dictationRecognitionFailed)從UITextView控件建立委託鏈接到接口構建器中的File Owner委託。 –