Note that there are some explanatory texts on larger screens.

plurals
  1. POUIWebView change image when orientation changes
    primarykey
    data
    text
    <p>I would like that my uiwebview change gif image when orientation changes so initially i'm using the following code to load the first image :</p> <pre><code>NSString * url = @"gif image url..."; int width = width of image; int height = height of image; NSString * htmlCode = [NSString stringWithFormat:@"&lt;html&gt;&lt;head&gt;&lt;body leftmargin=\"0\" topmargin=\"0\"&gt;&lt;img id=\"gifimg\" src=\"%@\" width=\"%i\" height=\"%i\"&gt;&lt;/body&gt;&lt;/html&gt;", url, width,height]; [tmpWebView loadHTMLString:htmlCode baseURL:nil]; </code></pre> <p>and i put the following code in orientationChanged function:</p> <pre><code>NSString url = @"portrait image url..."; int width = width of portrait image; int height = height of portrait image; if (deviceOrientation == UIInterfaceOrientationLandscapeLeft) { url = @"landscape image url..."; width = width of landscape image; height = height of landscape image; } NSString * jsString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('img')[0].style.width= '%dpx';document.getElementsByTagName('img')[0].style.height= '%dpx';document.getElementsByTagName('img')[0].src= '%@'", width,height, url]; [webview stringByEvaluatingJavaScriptFromString:jsString]; [jsString release]; [webview setBackgroundColor:[UIColor clearColor]]; [webview setOpaque:NO]; </code></pre> <p>So the image work fine at first display and when i rotate the device, the (landscape or portrait) the image appear but a part of it was truncated.(after each rotation a part of image is ignored.....), any idea?</p> <p>Thanks for help</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload