嗨,我正在制作电话空白。我的要求是从警告框和确认框中删除标题。我的确认框的代码是
navigator.notification.confirm(
"Are you sure you want to exit ?",
function(buttonIndex){
ConfirmExit(buttonIndex);
},
"Confirmation",
"Yes,No"
);
答案 0 :(得分:2)
您正在使用org.apache.cordova.dialogs
插件。我尝试了这个并让它工作,这是如何:
在项目中搜索notification.js文件,例如我的位于:
Users/ft/projectname/platforms/ios/www/plugins/org.apache.cordova.dialogs/www/notification.js
现在,打开它并执行“确认”查找,找到这一部分:
/**
* Open a native confirm dialog, with a customizable title and button text.
* The result that the user selects is returned to the result callback.
*
* @param {String} message Message to print in the body of the alert
* @param {Function} resultCallback The callback that is called when user clicks on a button.
* @param {String} title Title of the alert dialog (default: Confirm)
* @param {Array} buttonLabels Array of the labels of the buttons (default: ['OK', 'Cancel'])
*/
confirm: function(message, resultCallback, title, buttonLabels) {
var _title = (title || "Confirm");
var _buttonLabels = (buttonLabels || ["OK", "Cancel"]);
// Strings are deprecated!
if (typeof _buttonLabels === 'string') {
console.log("Notification.confirm(string, function, string, string) is deprecated. Use Notification.confirm(string, function, string, array).");
}
然后删除“确认”字样并将其留空:
var _title = (title || "Confirm"); --> var _title = (title || "");
现在警报部分只找到“警报”,您将在上面找到类似的代码:
var _title = (title || "Alert"); --> var _title = (title || "");
我正在使用Cordova 3.6和我上面提到的插件(所以请使用该插件URL并尝试一次,如果最初你没有得到它)这对我很有用,你可以看到我正在编辑来自www
里面的platforms/iOS
所以我从Xcode本身开始运行,也试试。
试着让我知道。
答案 1 :(得分:1)