我正在使用NSTimer
在我的firebase
數據庫中查找更新。我已將代碼放入我的viewDidLoad()
。停止NSTimer並解僱視圖控制器(swift)
NSTimer.scheduledTimerWithTimeInterval(5.0, target: self, selector: #selector(DriversInterfaceViewController.CheckFormularChild), userInfo: nil, repeats: true)
當用戶收到了文件中的數據庫中,我希望用戶轉到另一個ViewController
。問題是舊的ViewController
正在後臺運行,或者在更改View Controller
時定時器不停止。
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let nextViewController = storyBoard.instantiateViewControllerWithIdentifier("recievedMission") as! RecievedMissionViewController
self.navigationController!.pushViewController(nextViewController, animated: true)
如何解僱老View Controller
或如何停止的NSTimer
programmatically
?謝謝!