// 拍照添加文件
function appendByCamera() {
plus.camera.getCamera().captureImage(function(path) {
//reSizeFile(path); //处理图片的地方
});
}
// 从相册添加文件
function appendByGallery() {
plus.gallery.pick(function(path) {
//reSizeFile(path); //处理图片的地方
});
}
function showActionSheet() {
var bts = [{
title: "拍照"
}, {
title: "从相册选取"
}];
plus.nativeUI.actionSheet({
title: "选择照片",
cancel: "取消",
buttons: bts
},
function(e) {
if (e.index == 1) {
appendByCamera();
} else if (e.index == 2) {
appendByGallery();
}
}
);
}
单独调用 appendByCamera 或 appendByGallery 函数可以执行,
但是在showActionSheet 的回调中这两个函数不能执行
小思
IOS不行,Android可以
2015-02-05 09:36