简体   繁体   中英

UIWebview: Does not rotate and does not resize to fit the whole screen

The test code is available here for your comments.

1) Rotation problem:

I have implemented

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return YES;
}

in the WebViewController.m file, but it still does not rotate. (See the pictures below)

肖像

景观

2) The size issue

As you may notice in the pictures, the bottom part of the screen is blank (about 25% of the screen). I have checked the xib file and the UIWebView seems to be set correctly

Did I make any very obvious mistake?

You are not retaining the view controller for the web view in the application delegate.

To fix replace,

[self.window addSubview:wvc.view] -> [[self window] setRootViewController:wvc];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM