效果图如下:
//alpha 0.0白色alpha 1:黑色alpha 0~1:遮罩颜色,逐渐
self.backgroundColor= [UIColorcolorWithRed:0green:0blue:0alpha:0.4];
代码如下:
#import "TFMaskView.h"
@interface TFMaskView()
{
UIView *_backGroundView;
}
@end
@implementation TFMaskView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
[self loadMaskView];
[self initBtnView];
}
return self;
}
- (void)loadMaskView
{
self.frame = CGRectMake(0, 0, kDEVICEWIDTH, kDEVICEHEIGHT);
self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.4];
self.userInteractionEnabled = YES;
[self