this is my first project, and i try to set a button title for some time and after it should reset. This my code:
The first (test) snippet simply tries to set immediately to "tapped" and then after 2 secs to reset to "tap me". What i see is disappering the button for 2sec and then only "tap me" again!?
    @IBOutlet weak var button1: UIButton!
@IBAction func button1Tapped(sender: UIButton) {
    sender.setTitle("tapped", forState: .Highlighted)
    NSThread.sleepForTimeInterval(2.0)
    sender.setTitle("tap me", forState: .Normal)
}
The second example is more what i really want! But for some reason I immediately fail here, because the alert simply does not show up!?
Any hints?
    @IBOutlet weak var button2: UIButton!
@IBAction func button2Tapped(sender: AnyObject) {
}
func isOK(sender:UIAlertAction!){
    button2.setTitle("tapped", forState: .Normal)
    NSThread.sleepForTimeInterval(2.0)
    button2.setTitle("tap me", forState: .Normal)
}
func isCancel(sender:UIAlertAction!){
}
@IBAction func button2Tapped(sender: UIButton) {
    let alert = UIAlertController(title: "Test", message: "button", preferredStyle: UIAlertControllerStyle.Alert)
    alert.addAction(UIAlertAction(title:"OK", style: UIAlertActionStyle.Default, handler: isOK))
    alert.addAction(UIAlertAction(title:"Cancel", style: UIAlertActionStyle.Cancel, handler: isCancel))
    self.presentViewController(alert, animated: true, completion: nil)
}
OK, i changed to this:
    @IBOutlet weak var button1: UIButton!
@IBAction func button1Tapped(sender: UIButton) {
    sender.selected = true
    NSThread.sleepForTimeInterval(2.0)
    sender.selected = false
}
override func viewDidLoad() {
    super.viewDidLoad()
    button1.setTitle("tapped", forState: .Selected)
    button1.setTitle("tap me", forState: .Normal)
}
but it shows the same behaviour. Actually it shows "tapped" but only when i keep pressing!?
 
     
     
    