title: UIWebView content size in iOS 8
body: <p>I'm trying to display some content in a web view that's smaller than the screen. This works in iOS 7, but in iOS 8 the web view seems to automatically set the content size for the web view to the screen size. How can I convince <code>UIWebView</code> to use the view size for the content size in iOS 8?</p>
  
  <p>I've created a minimal example that illustrates the problem. Starting from Xcode's single-view iPad template, I added a web view that's 480px tall and 320px wide, centered in the parent view. I connected that to a <code>webView</code> outlet in the existing view controller. I then added some code to <code>-viewDidLoad</code> to load a .mp4 video into the web view. Here's the complete code:</p>
  
  <pre><code>@interface ViewController ()
  
  @property IBOutlet UIWebView *webView;
  
  @end
  
  NSString *const videoURL = @"https://dl.dropboxusercontent.com/u/29161243/Mahalo%2520Surf%2520Eco%2520Festival%25202014%2520-%2520Day%25204-SD.mp4";
  
  @implementation ViewController
  
  - (void)viewDidLoad {
      [super viewDidLoad];
  
      NSURL *url = [NSURL URLWithString:videoURL];
      NSURLRequest *request = [NSURLRequest requestWithURL:url];
      [self.webView loadRequest:request];
  }
  
  - (void)didReceiveMemoryWarning {
      [super didReceiveMemoryWarning];
  }
  
  @end
  </code></pre>
  
  <p>Under iOS 7, this does exactly what I want. The result looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/Wddrk.png" alt="iOS7 correctly displays the content"></p>
  
  <p>Under iOS 8, however, the video is enlarged and shifted down; it looks like the content size is the same as the screen size, with the content's origin at the origin of my web view:</p>
  
  <p><img src="https://i.stack.imgur.com/WqljX.png" alt="iOS8 enlarges the content"></p>
  
  <p><strong>How can I get the iOS 7 behavior in iOS 8?</strong> Alternatively, how can I adjust the web view content size?</p>
  
  <p>Even under iOS 7, <code>UIWebView</code> often shows some content (e.g. HTML pages) at a size that's larger than the web view frame. I'd also like to learn how to get the web view to scale this kind of content so that it's drawn completely inside the web view's width, but right now this is a secondary concern compared to getting video content scaled to the view.</p>