如何在NativeScript中引用self.view和self.view.frame

时间:2016-04-23 15:05:25

标签: javascript ios objective-c nativescript

我试图在iPad上调用NativeScript中的UIPrinterPickerController。我已经跟踪了我需要制作的电话,它就在这里:

UIPrinterPickerController.presentFromRectInViewAnimatedCompletionHandler(rect: CGRect, view: UIView, animated: boolean, completion: (arg1: UIPrinterPickerController, arg2: boolean, arg3: NSError) => void): boolean;

在示例中,我看到rect param是对self.view.frame的引用,而view param是对self.view的引用。如何在NativeScript中找到这些引用?我已经尝试了ui.view模块,但这并不起作用。我在args.object事件中尝试了pageLoaded,但这并不起作用。任何帮助将不胜感激。

// My code here
if ( ! UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiomPad) {
    found = printPicker.presentAnimatedCompletionHandler(false, completionHandler);
} else {
    found = printPicker.presentFromRectInViewAnimatedCompletionHandler(view.frame, view, false, completionHandler);
}

1 个答案:

答案 0 :(得分:1)

你实际上非常接近;页面的UIView;将是:

var pageLoaded = function(args) {
  var page = args.object;  // Get the NativeScript Page object
  var uiView = page.ios;   // Get the underlying iOS native Control
}