1. 给他设置一个代理类 UIWebView needs a delegate to reset it's size accoreding to it's content.
2. 代理类中实现如下方法 Implish "- (void)webViewDidFinishLoad:(UIWebView *) webView" in the delegate:
- (void)webViewDidFinishLoad:(UIWebView *) webView
{
CGSize actualSize = [webView sizeThatFits:CGSizeZero];
CGRect newFrame = webView.frame;
newFrame.size.height = actualSize.height;
webView.frame = newFrame;
}
3. OK.
阅读(5982) | 评论(0) | 转发(0) |