I\'m making a camera-based app and would like to make a frosted overlay on the camera preview, with a rounded rectangle cut out from the frosted view.
I\'ve been try
The UIView api says
An optional view whose alpha channel is used to mask a view’s content.
The best way to see this is to use a UIImageView loaded with an RGBA image that sports an alpha channel - a PNG exported with transparency switched on from photoshop will do it. And then resize, with the origin set to 0,0.
A second way to do it would be to create a UIView, with no alpha i.e. [UIColor clearColor]
and add a subview which has an alpha [UIColor whiteColor];
UIView *mask = [[UIView alloc] initWithFrame:(CGRect){0,0,100,100}];
mask.backgroundColor = [UIColor clearColor];
UIView *areaToReveal = [[UIView alloc] initWithFrame:(CGRect){20,20,50,50}];
areaToReveal.backgroundColor = [UIColor whiteColor];
[mask addSubview:areaToReveal];
_myView.maskView = mask;
You could add further UIViews which are translucent by x amount using [UIColor colorFromRed: green: blue: alpha:x];