Pergunta de entrevista da empresa Meta

How would you implement UIView hitTest mehtod?

Respostas da entrevista

Sigiloso

9 de dez. de 2018

UIView * hitTest(UIView *view, CGPoint point, UIEvent *event) { if (view == nil) return nil; if (CGRectContainsPoint(view.bounds, point)) return view; else hitTest(view.superView, point, event); }

1

Sigiloso

17 de fev. de 2018

Thanks for sharing your experience and much appreciated. It would be really great if could post remaining questions as well to help others to fulfil their dream job.

Sigiloso

9 de dez. de 2018

UIView * hitTest(UIView *view, CGPoint point, UIEvent *event) { if (CGRectContainsPoint(view.bounds, point); return view; for (UIView *view in view.subViews) { hitTest(view, point, event); } }

1