UIView利用hitTest添加点击事件
发表时间:2020-10-19
发布人:葵宇科技
浏览次数:38
UIView应用hitTest添加点击事宜
by 伍雪颖
[img]http://img.blog.csdn.net/20150104000303134?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcmFpbmxlc3Zpbw==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
CGPoint point = [[touches anyObject] locationInView:self.view];
CALayer *layer = [self.view.layer hitTest:point];
if (layer == self.blueView.layer) {
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] show];
}
}