views:

307

answers:

1

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 app locks up for six seconds.

Thanks

+2  A: 

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.

Eduardo Scoz