我尝试实施AirPrint打印并需要实例化UIPrintInteractionController
。但是,我似乎无法找到它。如何从NativeScript访问此UIKit类?
function findPrinter() {
var printController = UIPrintInteractionController.new();
console.log(printController);
}
exports.findPrinter = findPrinter;
答案 0 :(得分:2)
根据您的情况使用以下语法:
function findPrinter() {
var printController = UIPrintInteractionController;
console.log(printController.isPrintingAvailable());
}
exports.findPrinter = findPrinter;
以下是基于{N}文档
的Objective-C到JS的更多示例Objective-C 代码
NSMutableArray * array = [[NSMutableArray alloc] init];
Class buttonClass = [UIButton class];
UIButton * button = [[buttonClass alloc] init];
[array setObject: buttonClass atIndex: 0];
[array setObject: button atIndex: 1];
NativeScript 代码
var array = new NSMutableArray();
var buttonClass = UIButton;
var button = new buttonClass();
array.setObjectAtIndex(buttonClass, 0);
array.setObjectAdIndex(button, 1);
找到更多详情