title: Programmatically resize a UIViewController based on its container
body: <p>I have a simple UIViewController with just a UIWebView. The UIWebView should take all available space to show the content of an url.</p>
  
  <p>I would like to reuse this ViewController in various places. In some cases it will be pushed into a NavigationController, in some it will be shown as a ModalViewController. Sometimes it might be inside a TabBarController. The size of the UIWebView will vary from case to case.</p>
  
  <p>What's the best way to set the frame of the UIWebView without using the Interface Builder? In other words, how should I initialize webViewFrame in the following code? Or is there something else I'm missing? </p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
      UIWebView* webView = [[UIWebView alloc] initWithFrame:webViewFrame];
      webView.delegate = self;
      NSURLRequest* request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
      [webView loadRequest:request];
      [self.view addSubview:webView];
      [webView release];
  }
  </code></pre>
  
  <p>I have tried with different possibilities (self.view.frame, self.navigationController.view.frame, etc.), but nothing seems to work for all cases.</p>