开发者

Get frontmost subview

开发者 https://www.devze.com 2023-01-21 05:21 出处:网络
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

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消