-3
我想單擊一個按鈕來製作旋轉輪。我點擊了按鈕後旋轉了一個圓形圖像,並在一次旋轉後停止。現在我想顯示一個彈出窗口,顯示他得到了多少點。我打算用標籤來做到這一點。但我很困惑如何顯示彈出窗口。如何在Xcode,Swift3中循環旋轉UIImage後顯示彈出視圖?
我想單擊一個按鈕來製作旋轉輪。我點擊了按鈕後旋轉了一個圓形圖像,並在一次旋轉後停止。現在我想顯示一個彈出窗口,顯示他得到了多少點。我打算用標籤來做到這一點。但我很困惑如何顯示彈出窗口。如何在Xcode,Swift3中循環旋轉UIImage後顯示彈出視圖?
您可以使用UIAlertViewController
下行樂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)
使用alertViewcontroller https://developer.apple.com/reference/uikit/uialertcontroller –