Disable entire UIView

My application needs to save the image to disk. I do this in a separate thread, so the user interface is still responsive, BUT, I don't want the user to add a new image until the first one is saved (about 1 second.)

At the moment, I’ll turn off the β€œtake another photo” button and down it, but I’m wondering if there is a method that turns off the whole view by deleting the buttons and darkens the background, for example, what happens when the UIActionSheet is presented.

I looked through the UIView docs and don't see anything like it, but it seems like such a useful template that is often used by Apple, and I decided that I would ask, just in case there was such a thing.

Obviously, I could do it manually, but why reinvent the wheel if it is already part of the API.

TIA: John

+6
source share
2 answers

set any view (main view, view, etc.) that you want to disable to

view.userInteractionEnabled = NO 

and

 view.alpha = 0.3f 

and maybe even

 view.backgroundColor = [UIColor grayColor] 

For loading. These last two can be animated, btw

+21
source

Imagine another view with shadow and gradient, etc. above this view, thereby giving it the effect of gray hair with shadows. You can even create an image if you know your photoshop. Just show that the image on the UIImageView above this view will be locked. Give the image some nice translucency, shadow, etc. Etc.

+5
source

Source: https://habr.com/ru/post/898999/


All Articles