UIWebView — load external website, programmatically set initial zoom scale, and allow user to zoom afterwards

前端 未结 5 1164
忘了有多久
忘了有多久 2020-12-02 23:58

Is it possible to do all of the above? SO has given me a great way to set the initial zoom scale here. Namely, to include the following line in my webViewDidFinishLoad met

5条回答
  •  甜味超标
    2020-12-03 00:48

    It looks like the underlying UIScrollView is accessible starting from iOS 5.x.

    In webViewDidFinishLoad: you can request a zoom, for example:

    [webView.scrollView zoomToRect:CGRectMake(0.0, 0.0, 50.0, 50.0) animated:YES];
    

    This seems to work even with scalesPageToFit set to YES.

提交回复
热议问题