gpt4 book ai didi

iphone - ios 的 Cordova 3.0.0 ActionSheet 插件无法正常工作

转载 作者:行者123 更新时间:2023-11-28 22:29:22 25 4
gpt4 key购买 nike

我最近为 ios 安装了 cordova 3.0.0 版本,并尝试为 ios 创建 ActionSheet 插件。

现在,我的问题是当点击按钮时没有任何反应意味着 Actionsheet 没有打开。

它在模拟器中运行良好,但在设备中运行良好

当我双击主页按钮时,只显示操作表。它在 cordova 2.9.0 中运行良好。

我也检查了 Datepicker 插件,同样的问题发生了。

我的代码如下:

    var actionSheet = cordova.require("cordova/plugin/actionsheet");
var options = {
title: 'MyTestApp',
items: ['Open gallery','Cancel']
};

options.visibility = "auto";
options.onDismiss = openActionsheet;

actionSheet.show(options);

请帮助我......

最佳答案

我终于找到了解决方案。

将 .h 和 .m 文件放在 Plugins 文件夹中。现在在 www 中创建插件文件夹,在该 www/plugins/ActionSheet.js 文件夹中创建 ActionSheet.js 文件。

在 Config.xml 中添加以下行

<feature name="ActionSheet">
<param name="ios-package" value="ActionSheet" />
</feature>

现在您的 www 文件夹中的 config_plugin.js 文件位于此文件中的代码下方:

 {
"file": "plugins/ActionSheet.js",
"id": "ActionSheet",
"clobbers": [
"actionSheet"
]
}

现在你可以调用操作表方法如下:

    var options = {
title: 'Blownaway',
items: ['Open gallery','Cancel']
};


actionSheet.show(options);

无需在 ActionSheet.js 的 html 文件的脚本标记中包含 ActionSheet.js。

可以直接调用actionSheet.show方法。

关于iphone - ios 的 Cordova 3.0.0 ActionSheet 插件无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17924450/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com