Is there a way to access the UIViewController, the stage is running on? AFAIK there is something like that in RoboVM and on Android we have the FXActivity fur such tasks...
Thanks and regards, Daniel
Is there a way to access the UIViewController, the stage is running on? AFAIK there is something like that in RoboVM and on Android we have the FXActivity fur such tasks...
Thanks and regards, Daniel
If you have a look at the Charm Down plugins, some of them require native implementation on iOS, and in a few cases they also require access to the UIViewController
.
For instance, the Picture plugin iOS implementation requires access to the UIImagePickerController
, to create a subview that is added on top of the current view.
For that, you declare an interface:
@interface Pictures : UIViewController <...> {}
and later on you implement the access to that controller:
NSArray *views = [[[UIApplication sharedApplication] keyWindow] subviews];
UIView *_currentView = views[0];
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[_currentView.window addSubview:picker.view];
Notice that the iOS native code has to be compiled and added as a native library.
Check the task xcodebuild
here. You will have to use it in your build.gradle file to build the native library, then copy it to your project under src/ios/jniLibs. See this question for a custom use case of it.