开发者

Zoom out WebView on launch? Xcode x86_64 architecture

开发者 https://www.devze.com 2023-01-07 09:00 出处:网络
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 kno

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
0

精彩评论

暂无评论...
验证码 换一张
取 消