我使用RoboVM开发iOS应用.任务是在新窗口中打开摄像机或任何其他视图,然后返回到上一个结果.我已经成功地尝试了UIPopoverController,但是iPhone惯用语不支持它.那么,RoboVM中startActivityForResult的模拟方式是什么?
I develop iOS app with RoboVM. The task is to open camera or any another view in new window and then return to previous with some result. I have successfully tried UIPopoverController allready, but it is not supported by iPhone idiom. So, what is analogue for startActivityForResult in RoboVM?
PS. UIPopoverController解决方案的代码
PS. Code for UIPopoverController solution
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);推荐答案
在iPhone的Robovm上,您将希望全屏显示UIImagePickerController并显示以下内容:
On Robovm for iPhone, you will want to present the UIImagePickerController full-screen with something like:
UIWindow keyWindow = UIApplication.getSharedApplication().getKeyWindow(); if(keyWindow != null) { keyWindow.getRootViewController().presentViewController(imagePicker, true, null); }请参阅UIImagePickerController的文档,其中描述了呈现它的方法:
See the documentation for UIImagePickerController where it describes the ways to present it:
developer.apple. com/library/ios/documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html
更多推荐
RoboVM中的startActivityForResult模拟是什么?
发布评论