大家有没有试过,调用AirPrint时,如果先点击了作何输入框弹出软键盘后,再调用AirPrint都没有任何反应,例子代码:
<div>
<input type="text" style="width: 200px; height: 30px; float: left;" />
<button onclick="go_print();" style="width: 200px; height: 30px;">Print</button>
</div>
<script>
function go_print() {
var UIPrintInteractionController = plus.ios.import('UIPrintInteractionController');
var UIPrintInfo = plus.ios.import("UIPrintInfo");
var NSURL = plus.ios.import("NSURL");
//url字符串仅仅用来示例,可以使用plus.io获取
var url = NSURL.fileURLWithPath(plus.io.convertLocalFileSystemURL("_www/sources/OMS_BG.jpg"));
if ( UIPrintInteractionController.canPrintURL(url) ){
var printInfo = UIPrintInfo.printInfo();
printInfo.setJobName("OMS.png");
printInfo.setOutputType(1);
var printInteractionController = UIPrintInteractionController.sharedPrintController();
printInteractionController.setPrintInfo(printInfo);
printInteractionController.setShowsNumberOfCopies(true);
printInteractionController.setPrintingItem(url);
printInteractionController.presentAnimatedcompletionHandler(true, null);
} else {
alert("not support");
}
}
</script>
如果直接点button,可以正常弹出AirPrint打印窗口,而如果点击一下input输入框,弹出软键盘后,不论有无输入内容,再次点击button,程序会死掉,且也不会弹出AirPrint打印窗口。哪位高手知道是什么问题吗?
1 个回复
FullStack - 【插件开发】【专治疑难杂症】【ios上架、马甲包、白包、过审、已成功上架过几百个】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=22130】【非诚勿扰】QQ:543610866
打印插件:https://ext.dcloud.net.cn/plugin?id=7147