UILabel 的问题

发布于 2024-12-24 17:58:55 字数 169 浏览 2 评论 0原文

我真的不知道为什么这不起作用,有人可以解释一下我做错了什么以及如何解决它吗?

-(IBAction)working {
    workLength.text = @"Area =" Length.text @"x" Width.text;
}

提前致谢。

I don't really know why this isn't working, could someone please explain what I did wrong and how to fix it?

-(IBAction)working {
    workLength.text = @"Area =" Length.text @"x" Width.text;
}

Thanks in advance.

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

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

发布评论

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

评论(1

熊抱啵儿 2024-12-31 17:58:55

您需要告诉 Objective C 如何格式化您尝试在 UILabel 中设置的字符串。

做这样的事情:

-(IBAction)working
{
    workLength.text = [NSString stringWithFormat: @"Area = %@x%@", Length.text, Width.text];
}

You need to tell Objective C how to format the string you're trying to set in that UILabel.

Do something like this:

-(IBAction)working
{
    workLength.text = [NSString stringWithFormat: @"Area = %@x%@", Length.text, Width.text];
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文