首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UIPopoverPresentationController显示黑屏

UIPopoverPresentationController显示黑屏
EN

Stack Overflow用户
提问于 2014-09-30 04:02:33
回答 1查看 614关注 0票数 3

我正在开发一个应用程序,在那里我需要显示带有图像的弹出式窗口,我使用了UIPopoverController,现在在iOS8上这个类被弃用,苹果建议使用UIPopoverPresentationController代替,但当我尝试显示弹出式窗口时,我得到了一个黑屏。你能帮帮我吗?谢谢。

这是我试图在弹出窗口中打开名为"popVC“的视图控制器的代码。*vernazaImagenDetalle是一个UIViewController子类

代码语言:javascript
复制
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);

EN

回答 1

Stack Overflow用户

发布于 2016-07-11 22:01:12

对我来说,将以下代码添加到presentationControllerDelegate中是可行的-

代码语言:javascript
复制
  func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
    return .None;
  }
  func adaptivePresentationStyleForPresentationController(controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
    return .None;
  }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26107897

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档