UIAlertView点击背景消失的方法
来源:互联网 发布:针织女套裙淘宝网 编辑:程序博客网 时间:2024/05/25 18:12
_phoneAlert = [[UIAlertView alloc]initWithTitle:@"" message:@"请选择要选择的电话" delegate:self cancelButtonTitle:nil otherButtonTitles:@"商家电话",@"客服电话",@"客服微信", nil]; [_phoneAlert show]; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tap:)]; tap.numberOfTapsRequired = 1; tap.cancelsTouchesInView = NO; [[UIApplication sharedApplication].keyWindow addGestureRecognizer:tap];
- (void)tap:(UITapGestureRecognizer *)tap{ if (tap.state == UIGestureRecognizerStateEnded){ CGPoint location = [tap locationInView:nil]; if (![_phoneAlert pointInside:[_phoneAlert convertPoint:location fromView:_phoneAlert.window] withEvent:nil]){ [_phoneAlert.window removeGestureRecognizer:tap]; [_phoneAlert dismissWithClickedButtonIndex:0 animated:YES]; } }}
注意AlerView是在window上的,不是在view上的。
0 0
- UIAlertView点击背景消失的方法
- 关于自定义UIAlertView背景的方法收集
- iOS巅峰之点击UIAlertView的灰色部分也能dismiss消失
- PopupWindow点击边框以外消失的方法
- UIAlertView的自动消失,手动消失和自定制消失
- UIAlertView的自动消失,手动消失和自定制消失
- UIAlertView的自动消失,手动消失和自定制消失
- UIAlertView的自动消失,手动消失和自定制消失
- UIAlertView的自动消失,手动消失和自定制消失
- UIAlertView的自动消失、手动消失、自定义消失
- 给UIAlertView添加手势使点击区域外弹框消失
- UIAlertView的使用,以及自动消失
- iOS-UIAlertView的点击事件
- 搜索框点击文字消失、带背景
- 解决PopupWindow实现按钮点击消失和显示,以及点击它外围可以消失的方法
- UIButton点击后改变背景的方法
- UIButton点击后改变背景的方法
- UIAlertView的代理方法
- mysql存储过程实例
- ios 视图的层级关系
- java面向对象高级分层实例_BaseDao
- 服务框架Dubbo
- Android Service详解(一)---概述
- UIAlertView点击背景消失的方法
- simple make file
- C#常用控件属性及方法介绍
- Code Sign Error in macOS Sierra Xcode 8 : resource fork, Finder information, or similar detritus not
- Ubuntu下安装Apache+php+mysql
- Guava Cache缓存容量管理
- Maven最佳实践:版本管理
- 3086 区域发展
- 线程池控制并发数量