I have a problem in iOS. The green ViewController should turn after a few seconds to red and I have this code:
override func viewDidLoad() {
super.viewDidLoad()
let ZeitZahl = arc4random_uniform(1499) + 6000
usleep(ZeitZahl)
update()
}
and
func update(){
self.view.backgroundColor = UIColor(red: 1, green: 0, blue: 0, alpha: 1.0)
}
The turning to red itself works great! But it doesn't make a delay, it turned directly to red! I have tried it with usleep(5000)
instead of usleep(ZeitZahl)
but it didn't makes a pause. Please, what does I make wrong?