我正在IOS中使用phonegap框架創建應用程序。我有幾個輸入框是通過html/javascript中的phonegap創建的。我想爲其中一個輸入框輸入[UIKeyboardTypeEmailAddress]類型的軟鍵盤。IOS中特定輸入框的軟鍵盤類型
我在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可用。謝謝。