我正在尝试在 iPad 上使用 NativeScript 调用 UIPrinterPickerController。我已经找到我需要调用的电话,它就在这里:
UIPrinterPickerController.presentFromRectInViewAnimatedCompletionHandler(rect: CGRect, view: UIView, animated: boolean, completion: (arg1: UIPrinterPickerController, arg2: boolean, arg3: NSError) => void): boolean;
在我看到的示例中,rect
参数是对 self.view.frame
的引用,而 view
参数是一个引用到 self.view
。我如何在 NativeScript 中找到这些引用?我试过 ui.view
模块,但它不起作用。我已经从 pageLoaded
事件中尝试了 args.object
但它不起作用。任何帮助将不胜感激。
// My code here
if ( ! UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiomPad) {
found = printPicker.presentAnimatedCompletionHandler(false, completionHandler);
} else {
found = printPicker.presentFromRectInViewAnimatedCompletionHandler(view.frame, view, false, completionHandler);
}
最佳答案
你们其实很亲密;页面的 UIView;会是:
var pageLoaded = function(args) {
var page = args.object; // Get the NativeScript Page object
var uiView = page.ios; // Get the underlying iOS native Control
}
关于javascript - 如何在 NativeScript 中获取对 self.view 和 self.view.frame 的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36812469/