ios - iOS中特定输入框的软键盘类型

标签 ios objective-c cordova

我正在 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/

相关文章:

ios - 如何在协议(protocol)中声明通用协议(protocol)属性要求

ios - 如何编辑 Cocos2d 3.x sprite builder ccb 文件?

objective-c - 如何在今天午夜获取 NSDate 对象?

ios - 单击时删除 UITableViewCells 按钮

ios - cordova 运行时出现 ios 错误 .. 命令 : xcodebuild with args: 的错误代码 65

javascript - 单击输入字段触发窗口在android上调整大小

ios - prepareForSegue 什么时候被调用?

iphone - 修复 main.m 的泄漏

ios - 更改 UIButton 的 imageview 的 alpha

cordova - ionic 3 文档查看器插件