![](/img/trans.png)
[英]iOS hybrid app WKWebView soft keyboard covering input fields sometimes
[英]Soft keyboard type for a particular input box in IOS
我正在用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文本字段中使用'email'類型- <input type="email" />
?
如果您要做的只是為輸入顯示不同的鍵盤設置,請檢查HTML5輸入類型 。
例如,當您將輸入類型設置為電子郵件時,iPhone會將@鍵輸入鍵盤,因此輸入起來會容易一些。
<input type="email" />
或將其設置為數字時,它會顯示數字鍵盤
<input type="number" />
其他平台也支持HTML5輸入類型。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.