-1

I have a uiwebview loaded inside a UIScrollView..i Load inside the webView an HTMLString using this code :

    NSString * htmlString = [NSString stringWithFormat:@"\
                             <html>\
                             <table width='960'>\<tr>\<td>\
                             <body>\
                             <p style = 'font-size:25px;'> %@ <\p>\
                             </td></tr><tr><td><br><br></td></tr><tr><td align ='center'><br><img src='%@' height='600px'\><br></td></tr></body>\
                             </table>\
                             </html>",authorNAme , cachePath];

    WebV.opaque = NO;
    WebV.backgroundColor = [UIColor clearColor];  
    [self.WebV setScalesPageToFit:YES];
    [self.WebV loadHTMLString:htmlString baseURL:baseURL];

Instead of Height = '600px' i need height = 70% of the original image height...if i write height = '70%' , Xcode will take it as 70 px or so and just won't work...how can i fix this situation

Elias Rahme
  • 2,226
  • 3
  • 28
  • 53

2 Answers2

1

Write like:

height = 70%%

When you write like:

height = 70%

Xcode will expect an escape sequence after that.

In format strings, a ‘%’ character announces a placeholder for a value, with the characters that follow determining the kind of value expected and how to format it.

Midhun MP
  • 103,496
  • 31
  • 153
  • 200
1

You need to use 70%% instead of 70%

Gray
  • 7,050
  • 2
  • 29
  • 52
DivineDesert
  • 6,924
  • 1
  • 29
  • 61