UIWebView does not autoresist to fit the screen

I have an application that uses a UIViewController to display articles in a UIWebView, some of which have images. I configured it so that when I click on the image, it calls

- (void)displayImage:(NSInteger)i {
ImageViewController * imageVC = [[ImageViewController alloc] initWithImageId:i];
[self.navigationController pushViewController:imageVC animated:YES];
[imageVC release];

}

This loads another UIViewController. All my views respond perfectly to turns. ImageViewController maintains the aspect ratio of the image, and my ArticleViewController fills the screen with text. However, whenever I rotate the screen to landscape mode, viewing my ImageViewController and clicking the back button. The previous UIViewController automatically performs automatic correction, increasing the font size of the text, rather than putting more words in a line.

EDIT:

This is the article view controller:

This is an article view controller

ImageViewController, :

ImageViewCOntroller - portrait

, ...

ImageViewCOntroller - landscape

"", , .

ArticleViewCOntroller - landscape bad

, iPhone. , .

ArticleViewCOntroller - landscape good

, UIWebView , . , ?

+3
3

Interface Builder.

UIWebView Apple-3, " ".

"" , . , .

+5

, css : :

/* Landscape */
@media screen and (min-width: 321px)
{   
   body{
     width: 320px;
   }    
}
/* Landscape */
@media screen and (min-width: 321px)
{ 
   body{
     width: 480px;
   }    
}

: viewport:

<meta name="viewport" id="view" content="width=320px, minimum-scale=1.0, maximum-scale=1.0">

, :

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if(interfaceOrientation == UIDeviceOrientationLandscapeLeft)      
 [uiwebview stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementById(\"view\").setAttribute('content', 'width=480');"]];
}
....

, -

+1

. .

[webView setAutoresizingMask:(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth)];

+1

Source: https://habr.com/ru/post/1774418/


All Articles