如何在NativeScript中获取对self.view和self.view.frame的引用
我试图在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中find这些引用? 我已经尝试了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 }