Detect Callout overlap other UIViews in MKMapView

女生的网名这么多〃 提交于 2019-12-12 01:53:41

问题


I have Some UIViews that are displayed over an MKMapView to serve as controls to filter the content of the map and my mapView have annotations that can show callout.I want to create an effect where my overlays will fade away if my callout appears or gets scrolled under the overlays and become visible again after the callout does not takes its place.

Is there a way to find out if the Callout of an MKMapView is overlapping a UIView?

I have tried:

  1. Accessing frame of Callout to check if it intersects the overlays - couldn't access callout.
  2. Calculating where the callout will appear and keeping track of the scrolling to calculate if the callout goes under the overlay - Unable to predict behaviour of callout appearing - how it shifts to avoid popping up outside the screen
  3. Making overlay controls take a separate screen space as map - map becomes too small, certain screen area becomes unoccupied as controls do not take up a rectangular space. Will use this as last resort if no solution to my problem.

Edit

I made a gif of the effect I wanted

The Blue square will represent the controls and the red represent the callout, basically I want to make my overlay controls of my map fade away when the callout goes under it.

来源:https://stackoverflow.com/questions/41824421/detect-callout-overlap-other-uiviews-in-mkmapview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!