我正试图点击按钮制作一个旋转轮。我点击按钮时旋转圆形图像,一次旋转后停止。现在我想显示一个弹出窗口,显示他得到了多少积分。我打算用标签来做。但我对如何显示弹出窗口感到困惑。
答案 0 :(得分:0)
您可以使用UIAlertViewController
以下是swift 3代码
var alert = UIAlertController()
override func viewDidLoad() {
super.viewDidLoad()
self.alert = UIAlertController(title: "Congratulations!", message: "You have won 100 points", preferredStyle: .alert)
self.alert.addAction(UIAlertAction(title: "Done", style: .default, handler: {action in
switch action.style {
case .default:
//do your other stuff ahead after receiving points
case .cancel:
print("cancel")
case .destructive:
print("destruct")
}}))
}
//your rotation stopped
//call the UIAlertViewController
self.present(self.alert, animated: true, completion: nil)