【问题标题】:xcode - how to write 100% in code [duplicate]xcode - 如何在代码中编写 100% [重复]
【发布时间】:2015-01-07 07:47:23
【问题描述】:

我有一个问题,

htmltext = [NSString stringWithFormat:@"<style>width:100%"

和百分比(%)有一个警告:无效的转换说明符'"'

我们如何在 obj c 中写百分比,这是我在 webview 上写的。

谢谢!

【问题讨论】:

  • [NSString stringWithFormat:@"My Value: 100%%"];

标签: ios objective-c xcode uiwebview


【解决方案1】:

您应该使用 %% 转义 %

但是,如果您没有任何参数(如您的示例中所示),那么您应该使用:

htmltext = @"<style>width:100%";

【讨论】:

    【解决方案2】:

    试试这个 -

    htmltext = [NSString stringWithFormat:@"<style>width:100%%"];
    

    使用 %% 转义 %。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-02
      • 1970-01-01
      • 2019-06-13
      • 2015-08-05
      • 2014-02-11
      相关资源
      最近更新 更多