NSString stringWithFormat百分号

Jes*_*sse 11 nsstring stringwithformat

我搜索过,找不到这个答案......

如果我有这个,我怎么能让它显示最终的%符号?它只是在我的标签中省略了它.

[NSString stringWithFormat:@"Tries %i%", tries];
Run Code Online (Sandbox Code Playgroud)

Q8i*_*Q8i 28

我想我可以贡献一点并分享这个全面的选项列表.杰西是对的!

就我而言,以下是诀窍!

[NSString stringWithFormat:@"Progress: %.2f%%", progress*100] 
// progress is float ranging 0.0-1.0, 
//and I would like it to print up to 2 decimal point
Run Code Online (Sandbox Code Playgroud)

快乐的编码!