【问题标题】:UIPopoverPresentationController gives me black screenUIPopoverPresentationController 给我黑屏
【发布时间】:2014-09-29 20:02:32
【问题描述】:

我正在开发一个应用程序,我需要在其中显示带有图像的弹出框,我使用了 UIPopoverController,现在在 iOS8 上已弃用此类,Apple 建议改用 UIPopoverPresentationController,但是当我尝试显示弹出框时出现黑屏.你能帮助我吗?谢谢。

这是我尝试打开名为“popVC”的视图控制器作为弹出窗口的代码。 *vernazaImagenDetalle 是 UIViewController 的子类

vernazaImagenDetalle *vc =

[self.storyboard instantiateViewControllerWithIdentifier:@"popVC"];

vc.modalPresentationStyle = UIModalPresentationPopover;

[self presentViewController:vc animated: YES completion: nil];



UIButton *boton=(UIButton*)sender;

NSLog(@"tag %ld",(long)boton.tag);



UIPopoverPresentationController *presentationController =

[vc popoverPresentationController];

presentationController.permittedArrowDirections =0;

presentationController.sourceView =boton;

presentationController.sourceRect = CGRectMake(self.stringContenido.frame.size.width/2,(250+self.stringContenido.contentOffset.y),1,1);

【问题讨论】:

    标签: objective-c ios8 popover xcode6.0.1


    【解决方案1】:

    对我来说,将以下内容添加到 presentationControllerDelegate 工作 -

      func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
        return .None;
      }
      func adaptivePresentationStyleForPresentationController(controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
        return .None;
      }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-17
      • 1970-01-01
      • 2018-05-31
      • 1970-01-01
      • 1970-01-01
      • 2015-02-05
      • 1970-01-01
      相关资源
      最近更新 更多