Note that there are some explanatory texts on larger screens.

plurals
  1. POUIWebView: Fit frame to view size, allow scrollowing within that frame on UISplitViewController
    primarykey
    data
    text
    <p>This problem is driving me nuts.</p> <p>I have a UIWebView which I am trying to make fill the full view on the right side of a UISplitViewController:</p> <pre><code>CGSize boundsSize = self.view.bounds.size; self.webView = [[[UIWebView alloc] initWithFrame:CGRectMake(0, 0, boundsSize.width, boundsSize.height)] autorelease]; self.webView.delegate = self; self.webView.opaque = NO; self.webView.backgroundColor = [UIColor redColor]; self.webView.allowsInlineMediaPlayback = YES; self.webView.dataDetectorTypes = UIDataDetectorTypeAddress | UIDataDetectorTypeLink | UIDataDetectorTypePhoneNumber; self.webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin; [self.view addSubview:webView]; </code></pre> <p>First of all, how do I account for making the frame size fit the view when I don't know the orientation? Can I autoresize to the appropriate size?</p> <p>Next, when I load my HTML into my webView I want the frame size to stay the same (just like a UIScrollView does), but have that new content be able to be scrolled with that frame. Some content is much longer, some is not. So, I have tried to adjust the frame, but this just makes my frame larger rather than my content size.</p> <pre><code>- (void)webViewDidFinishLoad:(UIWebView *)aWebView { // Calculate the size of our webview CGRect frame = aWebView.frame; frame.size.height = 1; aWebView.frame = frame; CGSize fittingSize = [aWebView sizeThatFits:CGSizeZero]; frame.size = fittingSize; aWebView.frame = frame; }//end </code></pre> <p>Is this not possible? Do I need to put the webView inside of a UIScrollView and set the contentSize of that to the height of my new content every time I load it into my webView?</p>
    singulars
    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.
 

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