#defineSCREEN_WIDTH([[UIScreenmainScreen]bounds].size.width)#defineSCREEN_HEIGHT([[UIScreenmainScreen]bounds].size.height)@property(nonatomic,strong)UIView*deliverView;//底部View@property(nonatomic,strong)UIView*BGView;//遮罩-(void)appearClick{//------全屏遮罩self.BGView=[[UIViewalloc]init];self.BGView.frame=[[UIScreenmainScreen]bounds];self.BGView.tag=100;self.BGView.backgroundColor=[[UIColorblackColor]colorWithAlphaComponent:0.0];self.BGView.opaque=NO;//--UIWindow的优先级最高,Window包含了所有视图,在这之上添加视图,可以保证添加在最上面UIWindow*appWindow=[[UIApplicationsharedApplication]keyWindow];[appWindowaddSubview:self.BGView];//------给全屏遮罩添加的点击事件UITapGestureRecognizer*gesture=[[UITapGestureRecognizeralloc]initWithTarget:selfaction:@selector(exitClick)];gesture.numberOfTapsRequired=1;gesture.cancelsTouchesInView=NO;[self.BGViewaddGestureRecognizer:gesture];[UIViewanimateWithDuration:0.3animations:^{self.BGView.backgroundColor=[[UIColorblackColor]colorWithAlphaComponent:0.2];}];//------底部弹出的Viewself.deliverView=[[UIViewalloc]init];self.deliverView.frame=CGRectMake(0,SCREEN_WIDTH,SCREEN_WIDTH,SCREEN_WIDTH);self.deliverView.backgroundColor=[UIColorwhiteColor];[appWindowaddSubview:self.deliverView];//------View出现动画self.deliverView.transform=CGAffineTransformMakeTranslation(0.01,SCREEN_HEIGHT);[UIViewanimateWithDuration:0.3animations:^{self.deliverView.transform=CGAffineTransformMakeTranslation(0.01,0.01);}];}/***功能:View退出*/-(void)exitClick{NSLog(@"====");[UIViewanimateWithDuration:0.3animations:^{self.deliverView.transform=CGAffineTransformMakeTranslation(0.01,SCREEN_HEIGHT);self.deliverView.alpha=0.2;self.BGView.alpha=0;}completion:^(BOOLfinished){[self.BGViewremoveFromSuperview];[self.deliverViewremoveFromSuperview];}];}