lundi 30 novembre 2015

Random generator based off NStimer Xcode 7 swift 2 [on hold]

I want a function to be called at random times while the user is playing. For example after 2 seconds passed a function is called and then after another 6 seconds it is called again. How do I do that?

This is not working

    func time() {
randomNumber = CGFloat((drand48())
timer = NSTimer.scheduledTimerWithTimeInterval(randomNumber, traget: self, selector: "startTimer", userInfo: nil, repeats: true)

Xcode is not liking it and I donot know why




Aucun commentaire:

Enregistrer un commentaire