i have a UIView that is smaller than the superview so i can represent this view as a modal view when a button is clicked.
I have managed to do the following: * add a subview to the superview. * centered this modal view
I am now trying to make the elements behind the UIView unclickable. And also add a grey shadow te the ourside of my modal view so that the user understands that the modal view is the view in focus.
I would like to know how to achieve this.
I do not wish to use the presentation modal transition. I know and have already implemented this in other projects. Any help is appreciated.
The simplest thing would be to lay a fullscreen
UIView
with a translucent gray background behind your "modal" view. Then it will intercept all of the touches. It might look something like this:For future reference, you can set
myView.userInteractionEnabled = NO
to disable touch events on a view.There are several ways to do it. If you have a custom view which has custom location, you can modify it like that:
Create an instance
var
:And whenever you need it, put it behind your custom view:
When you do not need it anymore