Using this statement calls the selector immediately instead of 6 seconds from now.
this.PerformSelector(myStartWaitForSoundSelector, null, 6.0f);
Does anyone know how to get this to work with a delay?
I am using thread.Sleep(6000)
in the function that gets called, but the entire application locks up for six seconds.
Thanks.
You can use an NSTimer:
NSTimer.CreateScheduledTimer(new TimeSpan(0, 0, 6),
delegate { Console.WriteLine("teste"); });
That will cause the code inside the delegate to run after 6 seconds, without blocking the main application thread.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With