[英]JavaFXPorts on IOS - equivalent to FXActivity
Is there a way to access the UIViewController, the stage is running on?有没有办法访问 UIViewController,舞台正在运行? AFAIK there is something like that in RoboVM and on Android we have the FXActivity fur such tasks...
AFAIK 在 RoboVM 中有类似的东西,在 Android 上我们有 FXActivity 皮毛这样的任务......
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
.如果您查看 Charm Down插件,您会发现其中一些插件需要在 iOS 上进行本机实现,在某些情况下,它们还需要访问
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.例如,图片插件 iOS 实现需要访问
UIImagePickerController
,以创建添加到当前视图之上的子视图。
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.请注意,必须将 iOS 本机代码编译并添加为本机库。
Check the task xcodebuild
here .在此处检查任务
xcodebuild
。 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.您必须在 build.gradle 文件中使用它来构建本机库,然后将其复制到 src/ios/jniLibs 下的项目中。 See this question for a custom use case of it.
有关它的自定义用例,请参阅此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.