IOS弹出选择框:代码放在onclick中(mui)环境
function change() {
if (mui.os.plus) {
var a = [{
title: "拍照"
}, {
title: "相册选取"
}];
plus.nativeUI.actionSheet({
cancel: "取消",
buttons: a
}, function(b) {
switch (b.index) {
case 0:
break;
case 1:
getImage(); //调用摄像头
break;
case 2:
galleryImg();
break;
default:
break
}
})
}
}
获取拍照图片:
function getImage() {
var cmr = plus.camera.getCamera();
cmr.captureImage(function(p) {
plus.io.resolveLocalFileSystemURL(p, function(entry) {
var path = entry.toLocalURL();
$('#images').prepend('<div class="add-tp" id="dd' + picIndex + '">' +
'<img src="' + path + '