Xcode 自定义键盘 (DOT)

发布于 2024-11-02 15:27:08 字数 1432 浏览 0 评论 0原文

我正在尝试为 Iphone 制作一个自定义键盘(数字键盘):) 但我找不到编码点/“。”请帮助我!...

谢谢:)

我有这个:

- (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)number7:(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 = @"";
}

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)number7:(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 = @"";
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

仙女山的月亮 2024-11-09 15:27:08

将 number.text 的分配更改为创建字符串的方式:

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

在除点之外的所有其他情况下,您都覆盖了 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文