又是後要強制用戶選擇響應一個事件,那麼就要用一個層覆蓋整個用戶界面。以下是僞碼!
-(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;
}