How can I block UI thread without using sleep?
Just to be clear: I understand that UI will freeze for user, but that is the idea.
Can I run empty RunLoops? Any other ways.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you just want to block all interaction with your UI, call the
UIApplicationmethod-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, anNSRunLoopwould probably be the right approach.