You\'ve likely seen this before, its become exceedingly popular in consumery chic apps like ScoutMob. I\'m trying to implement a 60% transparent view on launch that will cover m
// get your window screen size
CGRect screenRect = [[UIScreen mainScreen] bounds];
//create a new view with the same size
UIView* coverView = [[UIView alloc] initWithFrame:screenRect];
// change the background color to black and the opacity to 0.6
coverView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6];
// add this new view to your main view
[self.view addSubview:coverView];
when you are done with it , you can remove it :
[coverView removeFromSuperview];
Swift3 version:
// get your window screen size
let screenRect = UIScreen.main.bounds
//create a new view with the same size
let coverView = UIView(frame: screenRect)
// change the background color to black and the opacity to 0.6
coverView.backgroundColor = UIColor.black.withAlphaComponent(0.6)
// add this new view to your main view
self.view.addSubview(coverView)
to remove it:
coverView.removeFromSuperview()