0
我正在研究一个应用程序,我很好奇如何创建响应通知事件的计数器。我有一个弹出的通知并询问你一个问题。您的选项是“解锁”和“取消”。我想要发生的是当我点击“解锁”时,屏幕上的UILabel递减。我有一个用于标签的IBOutlet设置,还有一个计数器。UIAlertAction递增/递减UILabel
var counter = 0
@IBOutlet weak var homeCounter: UILabel!
var alert = UIAlertController(title: "Confirm?", message: "", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Default, handler: nil))
alert.addAction(UIAlertAction(title: "Unlock", style:UIAlertActionStyle.Default, handler:nil))
self.presentViewController(alert, animated: true, completion: nil)