Popup dialog box
Use Navigator.notification.confirm () in PhoneGap to eject the native dialog box on iOS and get the click Index of the corresponding button, as follows:
navigator.notification.confirm( msg, //要显示的信息 backFn, //警告被忽略的回调函数 title, //标题 btns||‘取消,确定‘ //按钮名称 )
The following encapsulation is done in the current project:
showConfirm:function(msg,title,backFn,btns){ navigator.notification.confirm( msg, //要显示的信息 backFn, //警告被忽略的回调函数 title, //标题 btns||‘取消,确定‘ //按钮名称 )}
Camera or album
Use Navigator.camera.getPicture () in PhoneGap to call the camera or album. The prototype is as follows:
The test code is as follows:
Showconfirm (msg, ' OK 1 ', function (button) {if (Button = = 1) {//zm__ Test call camera//camera.picturesourcetype . Camera Camera//camera.picturesourcetype.photolibrary Camera.PictureSourceType.SAVEDPHOTOALBUM album Navigator. Camera.picturesourcetype = Camera.PictureSourceType.SAVEDPHOTOALBUM; Navigator.camera.getPicture (onsuccess, Onfail, {quality:50, DestinationType:destinationType.FILE_URI, Sourcetype:pi Cturesource.savedphotoalbum}); The successful callback function onsuccess (Imageuri) {console.log (Imageuri); }//Failed callback function onfail (message) {alert (' Failed becaus E: ' + message '); }}//if statement end else {console.log ("click Cancel 3"); }}, (' OK 2, cancel 3 ');}
One sentence, MD edit code It's hard.
PhoneGap simple use on iOS: Pop-up dialogs and call camera