我已经在 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