2017-03-16 71 views
-3

我想单击一个按钮来制作旋转轮。我点击了按钮后旋转了一个圆形图像,并在一次旋转后停止。现在我想显示一个弹出窗口,显示他得到了多少点。我打算用标签来做到这一点。但我很困惑如何显示弹出窗口。如何在Xcode,Swift3中循环旋转UIImage后显示弹出视图?

+0

使用alertViewcontroller https://developer.apple.com/reference/uikit/uialertcontroller –

回答

0

您可以使用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)