views:

44

answers:

1

Hello

A simple question: how can I block UI thread without using sleep?

Just to be clear: I understand that UI will freeze for user, but that's the idea...

Can I run empty RunLoops? Any other ways.

thank you

+3  A: 

If you just want to block all interaction with your UI, call the UIApplication method -beginIgnoringInteractionEvents. If you're actually trying to prevent the entire UI from doing anything (which is not a good idea—your application might block the appearance of a system notification, for instance), then yes, an NSRunLoop would probably be the right approach.

Noah Witherspoon
yes, this is ok. But just for example: how to block everything with RunLoop?
I'm not too familiar with run loops, but I think starting one with -run or -runUntilDate: would do that.
Noah Witherspoon