I'm building a Mac application for somebody, and it includes a WebView in it. I have already added the WebKit.framework, but for some reason, I just can't figure out how to zoom out on launch. I know where to put the code so it would do it on launch, but I don't know the code to zoom out. The page I'm viewing is too big for the WebView, so I'd like to make it a little bit s开发者_JAVA百科maller. If you could do this in Objective-C that would be great! Thanks in advance!
You can zoom the content of the webview by using the following code by giving different size factors.
NSView *clipView = [[[[previewWeb mainFrame] frameView] documentView] superview];
[clipView scaleUnitSquareToSize:NSMakeSize(.5, .5)];
webView.scalesPageToFit = YES; // where webView is your UIWebView
精彩评论