我使用RoboVM开发iOS应用程序。任务是在新窗口中打开相机或任何其他视图,然后返回上一个结果。我已经成功尝试了UIPopoverController,但iPhone不能支持它。那么,RoboVM中的startActivityForResult是什么类似的呢?
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);
答案 0 :(得分:1)
在Robovm for iPhone上,您需要在全屏显示UIImagePickerController,例如:
UIWindow keyWindow = UIApplication.getSharedApplication().getKeyWindow();
if(keyWindow != null) {
keyWindow.getRootViewController().presentViewController(imagePicker, true, null);
}
请参阅UIImagePickerController的文档,其中描述了呈现它的方法: