如何在NativeScript中获得对self.view和self.view.frame的引用 [英] How to get reference to self.view and self.view.frame in NativeScript
问题描述
我正在尝试在iPad上的NativeScript中调用UIPrinterPickerController.我已经找到了需要拨打的电话,就在这里:
I am trying to call the UIPrinterPickerController in NativeScript on an iPad. I've tracked down the call that I need to make and it is here:
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
,但这不起作用.任何帮助将不胜感激.
In the examples I've seen the rect
param is a reference to self.view.frame
and the view
param is a reference to self.view
. How do I find those references in NativeScript? I've tried the ui.view
module and that doesn't work. I've tried args.object
from the pageLoaded
event and that doesn't work. Any help would be appreciated.
// My code here
if ( ! UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiomPad) {
found = printPicker.presentAnimatedCompletionHandler(false, completionHandler);
} else {
found = printPicker.presentFromRectInViewAnimatedCompletionHandler(view.frame, view, false, completionHandler);
}
推荐答案
您实际上非常亲密;页面的UIView;将是:
You were actually very close; the UIView for the Page; would be:
var pageLoaded = function(args) {
var page = args.object; // Get the NativeScript Page object
var uiView = page.ios; // Get the underlying iOS native Control
}
这篇关于如何在NativeScript中获得对self.view和self.view.frame的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!