2011-07-27 67 views

回答

2

只有第一个参数是格式,所以你需要另一个stringWithFormat:来生成格式字符串。因此,像:

bl.text = [NSString stringWithFormat:[NSString stringWithFormat:@"%@%@", @"%", @"d"], 9]; 
                   //^OR @"%%%@", @"%d" if only the 'd' is variable 

虽然它看起来像一个NSScanner或-[NSNumber stringValue]什么的会更适合这种任务的。

+0

这是正确的,但我认为OP是疯狂的。 :) – jtbandes

相关问题