首页 > 学院 > 开发设计 > 正文

UIView重叠点击透过上层UIView

2019-11-08 00:25:31
字体:
来源:转载
供稿:网友

UIView重叠点击透过上层UIView

今天由于需求问题需要UIView的部分区域透过点击到下一层UIView所以搜索了一下资料发现只要重写pointInside就可以实现,swift代码如下

override func point(inside point: CGPoint, with event: UIEvent?) -> Bool{ let frame = aFrame // aFrame是指不能透过的view的frame这其实是根据需求来的,你也可以做透过的判断 if frame?.contains(point) ?? false { return true } else { return false } }
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表