Iphone 如何设置占位符字符(%)?

Iphone 如何设置占位符字符(%)?,iphone,objective-c,placeholder,Iphone,Objective C,Placeholder,在Objective-c中。。。 我想要表示占位符字符(%) 但是我的代码不 NSString *base = @"<style type=\"test/css\">div{width:100\%}</style><body>%@</body>"; NSString *html = [NSString stringWithFormat:base, @"hello world"]; NSLog(@"%@",html); NSString*base=

在Objective-c中。。。 我想要表示占位符字符(%) 但是我的代码不

NSString *base = @"<style type=\"test/css\">div{width:100\%}</style><body>%@</body>";
NSString *html = [NSString stringWithFormat:base, @"hello world"];
NSLog(@"%@",html);
NSString*base=@“div{width:100\%}%@”;
NSString*html=[NSString stringWithFormat:base,@“hello world”];
NSLog(@“%@”,html);
  • expect:div{width:100%}
  • 实数:div{width:100}
怎么了?

试试这个:

NSString *base = @"<style type=\"test/css\">div{width:100%%}</style><body>%@</body>";
NSString*base=@“div{width:100%%}%@”;
格式说明符的完整列表如下。

请尝试以下操作:

NSString *base = @"<style type=\"test/css\">div{width:100%%}</style><body>%@</body>";
NSString*base=@“div{width:100%%}%@”;
格式说明符的完整列表如下所示