IOS 上的 JavaFXPorts - 相当于 FXActivity

JavaFXPorts on IOS - equivalent to FXActivity

有没有办法访问 UIViewController,舞台 运行 开着?据我所知,在 RoboVM 中有类似的东西,在 Android 上我们有 FXActivity fur 此类任务...

感谢和问候, 丹尼尔

如果您查看 Charm Down plugins,其中一些需要在 iOS 上本地实现,在少数情况下,它们还需要访问 UIViewController

例如,图片插件 iOS implementation 需要访问 UIImagePickerController,以创建添加到当前视图顶部的子视图。

为此,您声明一个接口:

@interface Pictures : UIViewController <...> {}

稍后您实现对该控制器的访问:

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];

请注意,iOS 本机代码必须作为本机库进行编译和添加。

检查任务 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 以获得它的自定义用例。