我正在创建这样的 UIWebView
self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 300)];
NSString *s=[arrayWithTwoStrings objectAtIndex:0];
[self.webView setDelegate:self];
self.webView.backgroundColor=[UIColor clearColor];
self.webView.opaque=NO;
self.webView.scrollView.scrollEnabled=NO;
[self.webView loadHTMLString:s baseURL:nil];
self.webView.contentMode=UIViewContentModeScaleAspectFit;
self.webView.autoresizesSubviews = YES;
[self.webView setScalesPageToFit:FALSE];
[self.webView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
[self.webView sizeToFit];
CGFloat totalHeight = self.webView.frame.origin.y+self.webView.frame.size.height+30;
[self.webView setFrame:CGRectMake(0,0,320, totalHeight)];
我不适合基于内容的 webview 高度。
我已经尝试了一些搜索技术,但无法奏效