Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling user interaction of all views besides one

I'm trying to simulate a UIAlertView behavior. Basically I want to present a view and disable the user interaction of all other views on screen (besides the presented view). How would I go about doing this?

like image 870
Alex1987 Avatar asked Dec 22 '22 09:12

Alex1987


1 Answers

Your pretend alert view should consist of two views. The first one is the size of the screen and has userInteractionEnabled set to YES. This prevents any touches going through to the views underneath. You then add, as a subview of this view, your actual alert window, with whatever buttons etc. you like.

You can contain both of these in a new UIWindow which you can set the windowLevel on to ensure they are on top of anything else in the screen.

You can also add a very slight backgroundColor to the screen-sized view which will dim everything behind it, if that is appropriate for your interface.

like image 107
jrturton Avatar answered Jan 10 '23 05:01

jrturton