【问题标题】:Titanium SDK 8.2.0GA zoom in WebView not workingTitanium SDK 8.2.0GA 在 WebView 中的缩放不起作用
【发布时间】:2021-01-08 13:09:13
【问题描述】:

我们正在将现有的 Titanium 经典应用程序迁移到 Titanium SDK 8.2.0GA 及更高版本。我们在加载 html 页面的 iOS WebView 中激活缩放/捏缩放功能时遇到问题。我们假设问题是由于用 WKWebView 替换了 UiWebView,但我们看不到必须在哪里应用设置才能重新启用缩放功能。 html 页面,包括 js 和其他应用程序在 8.2.0GA 上运行起来就像一个魅力......

感谢您的建议。

'Viewport setting works perfect in SDK 7.4.0 but does not zoom in SDK 8.2.0GA
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=10.0, user-scalable=yes"/>

'This is an example webview we use
var webView = Ti.UI.createWebView({
    left : gutter,
    top : gutter,
    right : gutter,
    bottom : gutter,
    // This allows the translucent view and the background to shine through. You could set this to a standard RGB color and change the opacity if desired.
    backgroundColor : translucentViewOn ? 'transparent' : backgroundColor,
    opacity : animationsOn ? 0 : 1,
    enableZoomControls : true, // Android only
    // Default assumes that all HTML is in the HTML folder and the first file is index.html, you can change the next line to suit your HTML.
    url : '/HTML/index.html'
});

【问题讨论】:

    标签: ios webview zooming titanium-mobile


    【解决方案1】:

    以防万一,其他人也需要缩放。我们找到了正确的设置:

    var webView = Ti.UI.createWebView({
    url: href,
    backgroundColor: "transparent", //not relevant for zooming
    borderWidth: 1,                 //not relevant for zooming
    scalesPageToFit: false,
    willHandleTouches: false,
    disableZoom: false
    });
    
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=10, user-scalable=yes"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-16
      • 1970-01-01
      • 2012-11-14
      • 2015-05-26
      相关资源
      最近更新 更多