什么是RoboVM startActivityForResult模拟?(What is startA

2019-10-18 22:56发布

我发展与RoboVM iOS应用。 任务是在新窗口中打开相机或任何其他视图,然后返回到先前的一些结果。 我已经成功尝试UIPopoverController媒体链接,但它不是由iPhone成语的支持。 那么,什么是模拟的startActivityForResult在RoboVM?

PS。 代码UIPopoverController解决方案

final CGRect bounds = UIScreen.getMainScreen().getBounds();
UIViewController controller = app.getUIViewController();
UIImagePickerController imagePicker = new UIImagePickerController();
final UIPopoverController popoverController = new UIPopoverController(imagePicker);
imagePicker.setSourceType(UIImagePickerControllerSourceType.PhotoLibrary);
imagePicker.addStrongRef(popoverController);
popoverController.presentFromRectInView(new CGRect(x, y, viewWidth, viewHeight), controller.getView(), UIPopoverArrowDirection.Right, true);
popoverController.setPopoverContentSize(new CGSize(viewWidth, viewHeight), true);

Answer 1:

在Robovm的iPhone,你会想要的东西,如呈现的UIImagePickerController全屏:

UIWindow keyWindow = UIApplication.getSharedApplication().getKeyWindow();
if(keyWindow != null) {
    keyWindow.getRootViewController().presentViewController(imagePicker, true, null);
}   

见的UIImagePickerController文档它描述了目前它的方法:

https://developer.apple.com/library/ios/documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html



文章来源: What is startActivityForResult analogue in RoboVM?
标签: robovm