Get frontmost subview
I know UIView's hitTest:withEvent:
method digs down to the far-most view that gets the touch event, but how would yo开发者_StackOverflow中文版u get the opposite result? The first view to get an event at a certain CGPoint
?
EDIT
As zem pointed out, that hitTest method returns the farthest descendent in the view hierarchy. In my case, I have a mapView with a bunch of pinViews on it and I wanna get the frontmost pin at a certain CGPoint. That hitTest method keeps returning MKAnnotationContainerView
, which I assume is a UIView that contains all my pinViews. How do I make it return the pinView itself and not its furthest descendant?
精彩评论