Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24982] iOS/Android: Add zoomLevel to Ti.UI.WebView

GitHub Issuen/a
TypeNew Feature
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2018-05-16T00:01:02.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.3.0
ComponentsAndroid, iOS
Labelswebview
ReporterMichael Gangolf
AssigneeHans Knöchel
Created2017-07-19T08:14:27.000+0000
Updated2018-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();

Comments

  1. Michael Gangolf 2017-07-19

    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]];
       }
       

JSON Source