Mob*_*its 20 iphone objective-c ipad ios
我们是一个医疗保健应用程序.我们在应用程序中有一个符合HIPAA标准的语音识别器,通过它可以进行所有的听写.医院不希望医生不小心开始与不符合HIPAA标准的Nuance Dragon服务器对话.所以,我一直在寻找可以在键盘上按下听写键的方法.
我尝试在键盘上的Dictation按钮上放置一个假按钮,但在iPad上,分离式底座概念使麦克风在整个屏幕上移动.这听起来不是一个合理的解决方案.那里有专家可以帮助我吗?
Bad*_*ate 14
好的,终于明白了!诀窍是观察UITextInputMode更改通知,然后收集更改模式的标识符(代码似乎避免直接使用私有API,虽然似乎需要一点私有API的一点知识),并且模式更改时to dictation,resignFirstResponder(将取消语音听写).好极了!这是一些代码:
在您的应用代理中的某个地方(至少我放在哪里)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(inputModeDidChange:) name:@"UITextInputCurrentInputModeDidChangeNotification"
object:nil];
Run Code Online (Sandbox Code Playgroud)
然后就可以了
UIView *resignFirstResponder(UIView *theView)
{
if([theView isFirstResponder])
{
[theView resignFirstResponder];
return theView;
}
for(UIView *subview in theView.subviews)
{
UIView *result = resignFirstResponder(subview);
if(result) return result;
}
return nil;
}
- (void)inputModeDidChange:(NSNotification *)notification
{
// Allows us to block dictation
UITextInputMode *inputMode = [UITextInputMode currentInputMode];
NSString *modeIdentifier = [inputMode respondsToSelector:@selector(identifier)] ? (NSString *)[inputMode performSelector:@selector(identifier)] : nil;
if([modeIdentifier isEqualToString:@"dictation"])
{
[UIView setAnimationsEnabled:NO];
UIView *resigned = resignFirstResponder(window);
[resigned becomeFirstResponder];
[UIView setAnimationsEnabled:YES];
UIAlertView *denyAlert = [[[UIAlertView alloc] initWithTitle:@"Denied" message:nil delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil] autorelease];
[denyAlert show];
}
}
Run Code Online (Sandbox Code Playgroud)
The*_*der 10
您可以创建自己的键盘并为接受此听写的文本字段设置inputView.然后当他们按任意键时他们将获得你的键盘,因此你不必覆盖标准键盘上的键,你将能够自定义整个事物.
self.myButton.inputView = self.customKeyboardView;
Run Code Online (Sandbox Code Playgroud)
这是一个极其自定义键盘的示例
http://blog.carbonfive.com/2012/03/12/customizing-the-ios-keyboard/
Ray还有一个关于自定义键盘的teriffic教程.
http://www.raywenderlich.com/1063/ipad-for-iphone-developers-101-custom-input-view-tutorial
我希望有所帮助.
我有同样的问题,我发现隐藏听写按钮的唯一方法是改变键盘类型.对我来说,将其更改为电子邮件类型似乎是合理的:
textField.keyboardType = UIKeyboardTypeEmailAddress;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
10990 次 |
最近记录: |