Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gray out view in iphone, how?

I wonder what is the way to gray out portion of a view similar to the way UIAlertView grays out everything except the message box? Right now i use another custom view on top of the target area, but it doesnt look as nice.

Any ideas?

like image 371
Denis Masyukov Avatar asked Sep 16 '09 04:09

Denis Masyukov


People also ask

Why are Settings greyed out on iPhone?

There might be restrictions set up on your device, so tap Settings > Screen Time > Content & Privacy > scroll to Allow Changes, and check to see if Account changes are allowed. If not, enable them and check to see if your Apple ID is no longer grey.

Why is my iPhone name greyed out?

Is screen time set up on your iPhone? If so, check under Settings > Screen Time > Content & Privacy Restrictions. If Account Changes is enabled there, you won't be able to select your name.


1 Answers

I get good results using the method you have already tried. perhaps fiddling around with the alpha is a good idea?

mask = [[UIView alloc] initWithFrame:window.frame];
[mask setBackgroundColor:[UIColor colorWithWhite:0.0 alpha:0.78]];
[self.view addSubview:mask];

Then later in your code you can remove it:

[mask removeFromSuperview];
or
[mask setHidden:YES];

If you want to make it even better, I suppose you could try using a gradient, either programmatically, or as an image, and using this to darken the edges of the screen such that the content you are displaying forefront appears to be the light source.

like image 176
coneybeare Avatar answered Oct 11 '22 10:10

coneybeare