Pausing Main UI thread

Im am simply trying to create a pause or delay in the main UI thread that I have already acomplished with the Mac but IOS causes a Nilexception when i use the only command im aware of

Thread.CurrentThread.Sleep(500)

I guess Currentthread is not the main UI here.
I dont want to create a thread and run code in the thread i just want parts of my code with the main UI to pause for a few milliseconds.

Anyone know how?

You can’t block main thread.
If you would do that, your app would get killed.

You could run a tight loop to wait for 1 few milliseconds eg

dim t as double = system.milliseconds + 1000000 //1 second while system.milliseconds < t wend

Not entirely sure why you would want to do this though. Your GUI will not be updated during this time.

If you are doing a bunch of processing then put that in a thread and have a timer, on the main thread, poll the thread to show updates. That way you can sleep in your background thread.