【问题标题】:What is startActivityForResult analogue in RoboVM?RoboVM 中的 startActivityForResult 类比是什么?
【发布时间】:2013-11-11 08:13:12
【问题描述】:

我使用 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);

【问题讨论】:

    标签: robovm


    【解决方案1】:

    在 iPhone 版 Robovm 上,您需要全屏显示 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-04
      • 1970-01-01
      • 1970-01-01
      • 2011-04-02
      • 1970-01-01
      • 2023-03-21
      • 2011-02-10
      • 1970-01-01
      相关资源
      最近更新 更多