带声音的IOS警报信息

时间:2015-07-09 06:27:22

标签: ios xcode

有谁知道如何实现有声的警报信息?我基本上希望它在消息开启和关闭时反复使用默认的iOS警报噪音。

现在我已经实现了这样的信息:

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"My Alert Message" 
                                                message:@"Noise should be playing until you push 'OK'!" 
                                               delegate:nil 
                                      cancelButtonTitle:@"OK"
                                      otherButtonTitles:nil];
[alert show];

1 个答案:

答案 0 :(得分:2)

试试这个:

var url = webApiUri + "/Finance/";
    dataSource = new kendo.data.DataSource({
        transport: {
            read: {
                url: url + "GetBillItemList",
                data: { BillId: $('#BillId').val() },
                type: "GET",
                beforeSend: function (xhr) {
                    xhr.setRequestHeader('Authorization', 'Bearer ' + accessToken)
                }
            },
            create: {
                dataType: "json"
            },
        },
        batch: true,
        pageSize: 5,
        schema: {
            model: {
                id: "BillId",
                fields: {
                    BillItemId: { editable: false, nullable: true,hidden:true },
                    OfficeId: { field: "OfficeId",defaultValue: 1 },
                    ItemBill: { type: "integer", validation: { required: true },title:"@Mars.CultureResource.Entity.CultureResourceEntity.ItemBill" },
                    ItemNote: { type: "string", validation: { required: true }, title:"@Mars.CultureResource.Entity.CultureResourceEntity.ItemNote" },
                }
            }
        },
        aggregate:[
                    { field:"ItemBill", aggregate:"sum" }
        ],
    });

    $("#BillItemGrid").kendoGrid({
        dataSource: dataSource,
        navigatable: true,
        pageable: true,
        editable: "incell",
        toolbar: ["create"],
        pageable: {
            refresh: true,
            pageSizes: true,
            buttonCount: 5
        },
        columns: [
            { field: "BillItemId", title:"Bill Item Id", hidden:true},
            { field: "OfficeId", width: "150px", editor: categoryDropDownEditor,title: "Office",template: "#=getCategoryName(OfficeId)#"},
            { field: "ItemNote", title: "@Mars.CultureResource.Entity.CultureResourceEntity.ItemNote",footerTemplate:"Sum" },
            { field: "ItemBill", title: "@Mars.CultureResource.Entity.CultureResourceEntity.ItemBill",footerTemplate:"<span id='totalitembillfooter'> #= sum #</span> "  },
            { command: "destroy", title: "&nbsp;", width: 150 }],
        editable: true,
        edit: function(e) {
            var input = e.container.find(".k-input");
            $("[name='ItemBill']", e.container).blur(function(){
                onbillamountchange();
                $("#totalitembillfooter").html(calc());
            });

        },

    });

});

function categoryDropDownEditor(container, options) {
    $('<input required data-text-field="OfficeName" data-value-field="OfficeId" data-bind="value:' + options.field + '"/>')
        .appendTo(container)
        .kendoDropDownList({
            autoBind: false,
            dataSource:OfficeListArray
        });
}

function getCategoryName(OfficeId) {
    for (var idx = 0, length = OfficeListArray.length; idx < length; idx++) {
        if (OfficeListArray[idx].OfficeId === OfficeId) {
            return OfficeListArray[idx].OfficeName;
        }
    }
}

来源:https://stackoverflow.com/a/18160299/3202193