我正在开发一个应用程序,我需要显示带有图像的弹出窗口,我使用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);
答案 0 :(得分:0)
我将以下内容添加到presentationControllerDelegate中 -
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
return .None;
}
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
return .None;
}