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)