我正在开发一个应用程序,在那里我需要显示带有图像的弹出式窗口,我使用了UIPopoverController,现在在iOS8上这个类被弃用,苹果建议使用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);




发布于 2016-07-11 22:01:12
对我来说,将以下代码添加到presentationControllerDelegate中是可行的-
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
return .None;
}
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
return .None;
}https://stackoverflow.com/questions/26107897
复制相似问题