Domanda di colloquio di Meta

How would you implement UIView hitTest mehtod?

Risposte di colloquio

Anonimo

9 dic 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

Anonimo

17 feb 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.

Anonimo

9 dic 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