Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable whole UIView

Tags:

ios

uiview

My app needs to save an image to disk. I do this in a separate thread, so the UI is still responsive, BUT, I do not want the user to add a new image until the first one is saved (about 1 second.)

At the moment, I'm disabling the 'take another picture' button and greying it out, but I'm wondering if there is a method that will disable the whole view, greying out the buttons and darkening the background, like what happens when a UIActionSheet is presented.

I've looked through the UIView docs and don't see anything like this, but it seems like such a useful pattern that is frequently used by Apple that I figured I'd ask, just in case there was such a thing.

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

TIA: John

like image 761
John Avatar asked Oct 10 '11 20:10

John


1 Answers

set whatever view (main view, subview, etc.) you want to appear disabled to

view.userInteractionEnabled = NO 

and also

view.alpha = 0.3f

and maybe even

view.backgroundColor = [UIColor grayColor]

to boot. These last two can be animated, b.t.w.

like image 130
Michael Dautermann Avatar answered Oct 03 '22 23:10

Michael Dautermann