@interface CountryViewController
//背景
@property (strong, nonatomic) UIView *BackView;
end
//设置背景虚化
-(UIView *)BackView{
if (!_BackView) {
_BackView = [[UIView alloc]initWithFrame:self.view.bounds];
//背景虚化
UIColor *myColor = [UIColor colorWithWhite:0.5 alpha:0.5];
_BackView.backgroundColor = myColor;
[self.view addSubview:self.BackView];
//设置在当前控制器前面
[self.view bringSubviewToFront:self.BackView];
//一开始隐藏
self.BackView.hidden = YES;
//添加点击事件
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(actiondo)];
[_BackView addGestureRecognizer:tapGesture];
}
return _BackView;
}
//实现方法
-(void)actiondo{
NSLog(@"1231231231231231231231231231231");
}
//设置一个按钮事件
-(void)click{
//显示UIview
self.BackView.hidden = NO;
}