I'd like to "darken" a UIView by a certain amount. Right now, I'm doing the darkening like this:
UIView *overlay = [[UIView alloc] initWithFrame:mainView.bounds];
overlay.backgroundColor = [UIColor blackColor];
overlay.alpha = 0.5f;
[mainView addSubview:overlay];
Unfortunately, this also adds a semi-transparent black overlay to parts of mainView
that are transparent. Is there any way to only darken the non-transparent sections?