如何在UIToolBar键盘中添加自定义键?

时间:2012-12-10 08:28:39

标签: iphone ios uitoolbar

我想为十进制数字添加自定义键(图像上的红点),我该怎么做?

enter image description here

2 个答案:

答案 0 :(得分:2)

要解决此问题,您只需将键盘类型更改为UIKeyboardTypeNumbersAndPunctuation:

amountTextField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;

如果您使用此功能,则无需添加工具栏...您只需将UIKeyBoard的“RETURNKEYTYPE”添加为UIReturnKeyDone

amountTextField.returnKeyType = UIReturnKeyDone;

例如:

amountTextField = [[UITextField alloc] initWithFrame:CGRectMake(100, 4, 190, 26)];
amountTextField.backgroundColor = [UIColor clearColor];
amountTextField.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
amountTextField.returnKeyType = UIReturnKeyDone;
amountTextField.delegate = self;

答案 1 :(得分:0)

解决。我只需选择键盘:“十进制键盘”就像截图一样。

enter image description here