Ios nScript在标签的中间

Ios nScript在标签的中间,ios,nsstring,uilabel,Ios,Nsstring,Uilabel,如何使标签显示为:“大约30分钟”,其中NSString“scoreString”的值为30 以下是我必须单独显示字符串的内容: NSString *scoreString = [[score objectForKey:@"score"] stringValue]; testLabel.text = scoreString; 我只需要一种方法来写“about”,然后是scoreString,然后是“minutes”。您只需要创建一个新的字符串来组合每个组件。有几种方法可以做到这一点,但这可能是

如何使标签显示为:“大约30分钟”,其中NSString“scoreString”的值为30

以下是我必须单独显示字符串的内容:

NSString *scoreString = [[score objectForKey:@"score"] stringValue];
testLabel.text = scoreString;

我只需要一种方法来写“about”,然后是scoreString,然后是“minutes”。

您只需要创建一个新的字符串来组合每个组件。有几种方法可以做到这一点,但这可能是最简单的:

testLabel.text = [NSString stringWithFormat:@"about %@ minutes", scoreString];

您只需要创建一个新的字符串来组合每个组件。有几种方法可以做到这一点,但这可能是最简单的:

testLabel.text = [NSString stringWithFormat:@"about %@ minutes", scoreString];

令人惊叹的。谢谢我一有空就给你支票。太棒了。谢谢一旦我同意,我就给你支票。