如何在 NativeScript 中获取对 self.view 和 self.view.frame 的引用
How to get reference to self.view and self.view.frame in NativeScript
我正在尝试在 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
}
我正在尝试在 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
}