开发者

Xcode Custom Keyboard (DOT)

im trying to make a custom keyboard (a numberpad) for Iphone :) but i cant find out to code the dot/"." please help me!...

thank you :)

i have got this:

- (IBAction)dot:(id)sender{
numberr.text = [numberr.text stringByAppendingString:@"."];}

- (IBAction)number1:(id)sender{ 
    numberr.text = [NSString stringWithFormat:@"%.f1", [numberr.text floatValue]];
}
- (IBAction)number2:(id)sender{
        numberr.text = [NSString stringWithFormat:@"%.f2", [numberr.text floatValue]];
}
- (IBAction)number3:(id)sender{
    numberr.text = [NSString stringWithFormat:@"%.f3", [numberr.text floatValue]];
}
- (IBAction)number4:(id)sender{
    numberr.text = [NSString stringWithFormat:@"%.f4", [numberr.text floatValue]];
}
- (IBAction)number5:(id)sender{
    numberr.text = [NSString stringWithFormat:@"%.f5", [numberr.text floatValue]];
}
- (IBAction)number6:(id)sender{
    numberr.text = [NSString stringWithFormat:@"%.f6", [numberr.text floatValue]];
}
- (IBAction)numb开发者_如何学JAVAer7:(id)sender{
    numberr.text = [NSString stringWithFormat:@"%.f7", [numberr.text floatValue]];
}
- (IBAction)number8:(id)sender{
    numberr.text = [NSString stringWithFormat:@"%.f8", [numberr.text floatValue]];
}
- (IBAction)number9:(id)sender{
    numberr.text = [NSString stringWithFormat:@"%.f9", [numberr.text floatValue]];
}
- (IBAction)number0:(id)sender{
    numberr.text = [NSString stringWithFormat:@"%.f0", [numberr.text floatValue]];
}

- (IBAction)del:(id)sender{
    numberr.text = @"";
}


Change your assignments of number.text to this way of creating the string:

numberr.text = [numberr.text stringByAppendingFormat:@"%.f9", [numberr.text floatValue]];

You've been overwriting numberr.text in all other cases than the dot.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜