0

Webビューにロードしたいhtml文字列がありますが、結果として取得している値がいくつかあるので、実行時にこれらの値も追加したい

クリニックを訪れる犬の数を表示するように、この値に行を追加する必要があります。12人がいいね!

 NSString*dogspermonth=12;

 Number of dogs that visit clinic? <br>


 NSString*htmlString=@"<HTML>
 <HEAD>
 <TITLE>JAMSHED ALI</TITLE>
 </HEAD>
<BODY background="InsideBackgroundPage2.png">
<H6><font color="white">Cerenia Motion Sickness<br>
Model</br>Report
<p>Inputs</p>
<br>
 Number of dogs that visit clinic? <br>
 Number of dogs with motion sickness <br>
 Dogs treated with (per year):      <br>

Cerenia <br>                                       
Other prescription drugs<br>
Other means<br>                            
Other the counter drugs<br>  
<p>
Average cost to client for Cerenia prescription<br>      
Clinic markup<br><br>


Average number of dogs treated for car sickness<br>
Total number of dogs treated for car sickness<br>
Dogs treated with Cerenia<br>
Dogs treated with other drugs or interventions<br>

<br>  
  Profit for each Cerenia prescription<br>
  Annual Profit earned from Cerenia treatment<br>
  Potential annual profit increase  from using Cerenia to treat all dogs with motion sickness<br>
 Maximum annual profit if all dogs with car sickness were treated with Cerenia<br>
</BODY>
 </head>";
4

1 に答える 1

0

初めに

NSString*dogspermonth=12; //is wrong
NSString *dogspermonth=@"12"; //is correct if u want string else
NSInteger dogspermonth = 12; //will suffice

次のuは次のようなstringWithFormatを使用できます:

NSString *htmlString= [NSString stringWithFormat:@"<HTML>
 <HEAD>
 <TITLE>JAMSHED ALI</TITLE>
 </HEAD>
<BODY background="InsideBackgroundPage2.png">
<H6><font color="white">Cerenia Motion Sickness<br>
Model</br>Report
<p>Inputs</p>
<br>
 Number of dogs that visit clinic? %@<br> //%@ if string //%d if integer
 Number of dogs with motion sickness <br>
 Dogs treated with (per year):      <br>

Cerenia <br>                                       
Other prescription drugs<br>
Other means<br>                            
Other the counter drugs<br>  
<p>
Average cost to client for Cerenia prescription<br>      
Clinic markup<br><br>


Average number of dogs treated for car sickness<br>
Total number of dogs treated for car sickness<br>
Dogs treated with Cerenia<br>
Dogs treated with other drugs or interventions<br>

<br>  
  Profit for each Cerenia prescription<br>
  Annual Profit earned from Cerenia treatment<br>
  Potential annual profit increase  from using Cerenia to treat all dogs with motion sickness<br>
 Maximum annual profit if all dogs with car sickness were treated with Cerenia<br>
</BODY>
 </head>", dogspermonth];

それが役に立てば幸い。ハッピーコーディング:)

于 2012-05-23T06:24:22.453 に答える