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)
新聞熱點
疑難解答