[TIMOB-24982] iOS/Android: Add zoomLevel to Ti.UI.WebView
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2018-05-16T00:01:02.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 7.3.0 |
| Components | Android, iOS |
| Labels | webview |
| Reporter | Michael Gangolf |
| Assignee | Hans Knöchel |
| Created | 2017-07-19T08:14:27.000+0000 |
| Updated | 2018-05-16T00:01:05.000+0000 |
Description
Add the method
zoomBy to Ti.UI.WebView to allow zooming the webpage.
var win = Ti.UI.createWindow();
var webView = Ti.UI.createWebView({
url: "http://test.de"
});
var btn = Ti.UI.createButton({
title: "Zoom",
bottom: 50
});
btn.addEventListener("click", function(e) {
webView.zoomBy(2);
});
win.add(webView);
win.add(btn);
win.open();
PR Android: https://github.com/appcelerator/titanium_mobile/pull/9226 iOS will follow (thanks [~hknoechel])
- (void)zoomBy:(id)value { ENSURE_SINGLE_ARG(value, NSNumber); [[(TiUIWebView *)[self view] webview] stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.body.style.zoom = %@;", value]]; }