如何只使用数字键盘
我在 iPhone 中制作了一个温度转换器的应用程序,我希望当它在模拟器中启动时,只有数字键盘应该出现,而不是字母键盘。
#import "farh_celcius_conv_AppDelegate.h"
float i;
float s;
float p;
@implementation farh_celcius_conv_AppDelegate
@synthesize window,display,farhenite,display1;
-(IBAction) convert {
s = ('0','1','2');
if( p == s)
{
NSString *str = farhenite. text;
float n = [str floatValue];
if (n != 0) {
k =.5559* (n-32);
i = 5*(n -32)/9 +273 ;
[display setText:[NSString stringWithFormat:@"%f",k]];
[display1 setText:[NSString stringWithFormat:@"%f",i]];
}
}
}
- (void)dealloc {
[window release];
[super dealloc];
}
@end
i had made an application of temperature converter in iphone i want that when it launches in simulator only numeric keyboard should come and not the alpha keyboard.
#import "farh_celcius_conv_AppDelegate.h"
float i;
float s;
float p;
@implementation farh_celcius_conv_AppDelegate
@synthesize window,display,farhenite,display1;
-(IBAction) convert {
s = ('0','1','2');
if( p == s)
{
NSString *str = farhenite. text;
float n = [str floatValue];
if (n != 0) {
k =.5559* (n-32);
i = 5*(n -32)/9 +273 ;
[display setText:[NSString stringWithFormat:@"%f",k]];
[display1 setText:[NSString stringWithFormat:@"%f",i]];
}
}
}
- (void)dealloc {
[window release];
[super dealloc];
}
@end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以为文本字段设置各种类型的键盘。查看“文本输入特征”、“键盘”下的检查器。
You can set various types of keyboard for your text field. Look into inspector under Text Input traits, keyboard.
试试这个,
或者
您也可以在 nib 文件中执行此操作。
Try this,
or
You can also do this in the nib file.