自定义一个全屏的view(subview)覆盖当前视图

来源:互联网 发布:短作业优先算法例题 编辑:程序博客网 时间:2024/05/01 05:47

又是后要强制用户选择响应一个事件,那么就要用一个层覆盖整个用户界面。以下是伪码!

-(void)handleSingleTap:(UIGestureRecognizer *)gestureRecognizer{    [guideView setHidden:YES];}显示一个view 全屏-(void)show{UIWindow *keyv=[[UIApplication sharedApplication] keyWindow];UIView *viewss=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];[viewss setBackgroundColor:[UIColor redColor]];viewss.alpha=0.4;[keyv addSubview:viewss];    guideView =[[UIView alloc]initWithFrame:self.navigationController.view.bounds];    [guideView setBackgroundColor:[UIColor redColor]];    [guideView setUserInteractionEnabled:YES];    UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];        [guideView addGestureRecognizer:singleTap];    [self.navigationController.view addSubview:guideView];    return;}


0 0
原创粉丝点击