swatkins
swatkins

Reputation: 13640

How to get reference to self.view and self.view.frame in NativeScript

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;

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);
}

Upvotes: 0

Views: 824

Answers (1)

Nathanael
Nathanael

Reputation: 5399

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
}

Upvotes: 2

Related Questions