首页 > 学院 > 开发设计 > 正文

使用UIAlertControllerStyleActionSheet IPAD崩溃 swift

2019-11-07 23:58:23
字体:
来源:转载
供稿:网友

 let alert = UIAlertController(title:nil, message: nil, PReferredStyle: .ActionSheet)        let action = UIAlertAction(title:"保存到相册".localized(), style: .Default) { (action)in            self.loadImageFinshed(self.codeImageView.image!)        }        let action1 = UIAlertAction(title:"识别图中二维码".localized(), style: .Default) { (action)in            self.code(self.codeImageView.image!)        }        let action2 = UIAlertAction(title:"取消".localized(), style: .Cancel, handler:nil)        alert.addAction(action)        alert.addAction(action1)        alert.addAction(action2)//适配ipad需要加这两句        alert.popoverPresentationController?.sourceView =self.view        alert.popoverPresentationController?.sourceRect = CGRect(origin:self.view.center, size: CGSize(width:1, height: 1))        self.presentViewController(alert, animated:true, completion: nil)


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表