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)
————————————————
版权声明:本文为CSDN博主「qq_25592881」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_25592881/article/details/56845398