我有一些问题。在我的应用程序开始时,我自动显示数字键盘(我将 becomeFirstResponder 发送到其中一个文本字段)。但是,如果用户在我的应用程序之前使用过表情符号键盘,则会显示表情符号键盘。我怎样才能避免它?我想准确显示数字键盘,而不是表情符号键盘。
最佳答案
使用键盘通知并使用一些 BOOL 变量跟踪键盘,
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasHidden:) name:UIKeyboardDidHideNotification object:nil];
使用 BOOL 变量检查键盘是否已经存在。如果它在那里,请辞职并显示您的键盘。
关于iphone - 表情符号将我的键盘更改为...,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7913827/