我正在 IOS 中使用phonegap 框架创建一个应用程序。我有一些输入框是通过 html/javascript 中的phonegap 创建的。我想要为输入框之一使用 [UIKeyboardTypeEmailAddress] 类型的软键盘。
我在AppDelegate.h中的代码如下:
@property (nonatomic, strong) IBOutlet UITextField* textField;
- (void) setKeyboardType: (UIKeyboardType)newType;
对于AppDelegate.m,如下:
@synthesize textField;
//function definition
- (void) setKeyboardType: (UIKeyboardType) newType
{
//NSLog(@"setKeyboardType: %@", newType);
textField.keyboardType = newType;
}
并从另一个函数调用,如下所示:
[self setKeyboardType: (UIKeyboardType) UIKeyboardTypeEmailAddress];
此代码不适用于任何输入框。另外,我怎样才能将特定输入框的条件设置为具有这种类型。输入框ID可用。谢谢。
最佳答案
您是否尝试过在 html 文本字段上使用“电子邮件”类型 - <input type="email" />
?
关于ios - iOS中特定输入框的软键盘类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14400881/