Question d’entretien chez Meta

How would you implement UIView hitTest mehtod?

Réponses aux questions d'entretien

Utilisateur anonyme

9 déc. 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

Utilisateur anonyme

17 févr. 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.

Utilisateur anonyme

9 déc. 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