-1
在我正在製作的應用程序中,我按下按鈕,出現動畫,然後出現一個彈出窗口。 當我調用一個動作時,我正在運行它們,但動畫會在彈出彈出窗口之前完成。如何讓iOS彈出窗口延遲0.5秒?
如何讓xcode在激活後延遲0.5秒彈出?
在我正在製作的應用程序中,我按下按鈕,出現動畫,然後出現一個彈出窗口。 當我調用一個動作時,我正在運行它們,但動畫會在彈出彈出窗口之前完成。如何讓iOS彈出窗口延遲0.5秒?
如何讓xcode在激活後延遲0.5秒彈出?
這是我用來讓我的彈出延遲。只是延遲值更改爲自己的喜好
let delay = 0.5 * Double(NSEC_PER_SEC)
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay));
dispatch_after(time, dispatch_get_main_queue(), {
// enter your popup code here
let alert = UIAlertController(title: "DELAYED POPUP", message: "THIS WORKED NICELY", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "Awesome", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)
})
[的NSTimer(https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/index.html)? – 2014-10-20 20:18:48
感謝您的回覆。我將如何使用一個? (我很缺乏經驗) – Yugaman 2014-10-20 20:20:04
我推薦閱讀文檔和/或其中的一些教程,並嘗試使用它。如果沒有更堅實的基礎建立起來,向您提供更多細節將會很困難。 – Krease 2014-10-20 20:22:45