RoboVM中的startActivityForResult模拟是什么?

编程入门 行业动态 更新时间:2024-10-22 08:08:03
本文介绍了RoboVM中的startActivityForResult模拟是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用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模拟是什么?

本文发布于:2023-11-15 08:07:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1592647.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:RoboVM   startActivityForResult

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!