【问题标题】:UIModalPresentationFormSheet is not working for UIImagePickerController(For Camera) in iOS7UIModalPresentationFormSheet 不适用于 iOS7 中的 UIImagePickerController(For Camera)
【发布时间】:2013-09-27 05:44:07
【问题描述】:

我正在使用一个需要同时支持 iOS6 和 iOS7 的应用 UIModalPresentationFormSheet (modalPresentationStyle) 在 iOS7 中不适用于 UIImagePickerController(For Camera),但在 iOS6 中可以正常工作。

我该怎么办?

【问题讨论】:

  • 进行此更改时是否收到任何类型的错误消息或编译器错误?

标签: iphone objective-c xcode ios6 ios7


【解决方案1】:

根据Apple's documentation of UIImagePickerController,它应该显示在弹出框内。如果您不能适应这种情况,您可能不得不自己动手,或者使用开源。

【讨论】:

    【解决方案2】:

    您可以使用以下代码从 ipad 和 iphone 的相机或图库中获取图像。与 ipad 一样,您无法使用 presentmodalviewcontroller 获取图像。

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
        UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker];
        [popover presentPopoverFromRect:self.selectedImageView.bounds inView:self.selectedImageView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
        self.popOver = popover;
    } else {
         [self presentViewController:picker animated:YES completion:nil];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多