click the area around the prompt view to hide the promot view

// 点击提示框视图以外的其他地方时隐藏弹框
-(void)touchesBegan:(NSSet<UITouch > )touches withEvent:(UIEvent *)event{

CGPoint point = [[touches anyObject] locationInView:self];
point = [self.alertView.layer convertPoint:point fromLayer:self.layer];
if (![self.alertView.layer containsPoint:point]) {
    self.hidden = YES;
}

其中。alertview为提示view,改为你的提示框即可。

截屏2020-04-23 下午5.26.47

此为获取到非提示框区域需要执行的事件,可以改为你的。

截屏2020-04-23 下午5.26.47


   转载规则


《click the area around the prompt view to hide the promot view》 采用 知识共享署名 4.0 国际许可协议 进行许可。
 上一篇
KVO进阶 KVO进阶
KVO的流程图 一. KVO的定义 Key-value observing is a mechanism that allows objects to be notified of changes to specified propert
2020-04-24
下一篇 
学习资料链接 学习资料链接
C语言学习 C++学习 Unity学习 数据在内存中的存储(二进制形式存储)计算机要处理的信息是多种多样的,如数字、文字、符号、图形、音频、视频等,这些信息在人们的眼里是不同的。但对于计算机来说,它们在内存中都是一样的,都是以二进制的形
2020-04-21
  目录