1
我有以下UIWebView
實現,我想在webview加載後設置滾動。但是,以編程方式滾動對UIWebView
沒有影響。以編程方式滾動對UIWebView沒有影響
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
NSString *urlAddress = @"http://www.xxxx.com/private-dining";
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[privateDiningWebView loadRequest:requestObj];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
privateDiningWebView.scrollView.contentOffset = CGPointMake(0, 300);
});
}
,你不應該調用'vieDidLaoad'這種方法 – Dhiru