在浏览器窗口中使用完成按钮的Titanium open url

Yah*_*din 3 titanium appcelerator ios appcelerator-titanium appcelerator-alloy

在Titanium中,我知道可以在浏览器中打开URL,如下所示:

Ti.Platform.openURL("http://example.com/foo");
Run Code Online (Sandbox Code Playgroud)

但是这会在这样的浏览器中打开它:

正常

与Slack等其他iOS应用相比,它看起来像这样:

Slack Browser

正如您在顶部看到的那样,它有一个完成按钮,无法更改网址.还可以选择在Safari上打开它.

在Facebook Messenger iOS应用程序上打开它,它看起来像这样:

fb浏览器

如何更改Titanium在iOS上打开URL的方式,以便它使用类似于Slack中使用的浏览器.

Ren*_*Pot 5

您正在寻找的是本机组件,它是Appcelerator在模块中的包装器ti.safaridialog.您可以在文档中查看有关它的规范

将其添加到您的应用中

<module platform="iphone">ti.safaridialog</module>
Run Code Online (Sandbox Code Playgroud)

然后使用它

var dialog = require('ti.safaridialog');
if (dialog.isSupported()) {
    dialog.open({
        url: 'http://appcelerator.com',
        title: 'Titanium rocks!',
        tintColor: 'red'
    });
}
Run Code Online (Sandbox Code Playgroud)