I have a question about UIWebView in xcode, example code is below, add it to UIWebView .
- (void)viewDidLoad { [super viewDidLoad]; webview.frame=CGRectMake(0, 200, 768, 1024); [webview.scrollView setContentSize:CGSizeMake(768, 5000)]; [webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.baidu.com"]]]; webview.backgroundColor=[UIColor redColor]; } - (IBAction)button2pressed:(id)sender { webview.frame=CGRectMake(0, 200, 768, 1024); NSLog(@"%f,%f",webview.scrollView.contentSize.height,webview.scrollView.contentSize.width); } - (IBAction)button1pressed:(id)sender { webview.frame=CGRectMake(0, 300, 768, 1024); NSLog(@"%f,%f",webview.scrollView.contentSize.height,webview.scrollView.contentSize.width); }
After I press button1 and button2 , all the answers are 5000,768 .
But when I resize (0,300,768,1024) to (0,300,768,1044) , then the answer changed to 1024,768 and 1044,768 , this means that scrollview contentSize changed.
Who can tell me how to resize the webview without resizing the scroll? I am using xcode 4.3.2 and iOS SDK 5.1.
I find that if I change the size to (0,300,200,200) and use "www.qq.com", then it seems that the answer is always 4218,1000, unless I change the size of the rectangle in excess of (4218,1000). Therefore, I think there are some options saved in webview or scrollview to control the minimum size of scrollview. Who knows the options I'm looking for?