开发者

Disable whole UIView

开发者 https://www.devze.com 2023-04-12 14:53 出处:网络
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.)

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, l开发者_Go百科ike 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


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.


Present another view with the shadow and the gradient etcetera over this view thus giving it an effect of graying out with shadows. You may even create an image if you know your photoshop. Just show that image on a UIImageView over this view to be blocked. Give the image some nice translucency, shadows etc etc

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号