开发者

how to use only numeric keyboard

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 stringWit开发者_如何转开发hFormat:@"%f",k]];
        [display1 setText:[NSString stringWithFormat:@"%f",i]];     
    }   
}
}

- (void)dealloc {
    [window release];
    [super dealloc];
}


@end


You can set various types of keyboard for your text field. Look into inspector under Text Input traits, keyboard.


Try this,

 yourTextField.keyboardType = UIKeyboardTypePhonePad;

or

 yourTextField.keyboardType = UIKeyboardTypeNumberPad;

You can also do this in the nib file.


[myTextField setKeyboardType:UIKeyboardTypeNumberPad];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜