如何在NativeScript中获得对self.view和self.view.frame的引用

问题描述:

我正在尝试在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
}