如何在iOS 4.1 SDK中使用新的UIKeyboardTypeDecimalPad功能 [英] How to use the new UIKeyboardTypeDecimalPad feature in iOS 4.1 SDK

查看:99
本文介绍了如何在iOS 4.1 SDK中使用新的UIKeyboardTypeDecimalPad功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我正在使用学习为iphone编程,我正在使用具有标准数字键盘的示例应用程序。我也需要输入小数点,但数字小键盘没有。
SDK 4.1支持此功能,但我无法将键盘类型设置为UIKeyboardTypeDecimalPad,至少我没有在Interface Builder中看到该选项。可以通过Interface Builder完成吗?如果没有,那么在哪里可以添加这个代码?

Right now I am using learning to program for the iphone and I am using a sample application that has the standard numeric keypad. I need to enter decimal points too but the numeric keypad does not have any. The SDK 4.1 supports this feature but I cannot set the keyboard type to be UIKeyboardTypeDecimalPad, at least I do not see the option in Interface Builder. Can this be done from the Interface Builder? if not then where can add this in code?

谢谢。

推荐答案

您需要在代码中添加此内容。接口构建器似乎还没有使用它。您应该能够在控制器的viewDidLoad方法中为UITextField添加它。当然,您的文本字段需要连接到IBOutlet。

You need to add this in your code. Interface builder doesn't seem to use it yet. You should be able to add it in for your UITextField in the viewDidLoad method of your controller. Of course, your text field will need to be wired to an IBOutlet.

- (void)viewDidLoad
{
    [super viewDidLoad];
    myTextField.keyboardType=UIKeyboardTypeDecimalPad;
}

这篇关于如何在iOS 4.1 SDK中使用新的UIKeyboardTypeDecimalPad功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆