how to find where the user tapped on the screen in ios

ぐ巨炮叔叔 提交于 2019-12-12 01:46:30

问题


I want to find where user tapped on MapKit. I cannot find a action to make a connection so i am wondering there is an alternate method for the same. please let me know.


回答1:


As @Disco S2 says, add the instance of MKMapView as a subview to your view. To know where your user tapped on the map, use this method:

- (CGPoint)convertCoordinate:(CLLocationCoordinate2D)coordinate toPointToView:(UIView *)view



回答2:


Put the mapkit inside a view and listen for touches in that view. There is then a method to convert the touch in the mapView to a touch in the view and vice versa. I can't remember the method for converting but it will be in the map kit documentation



来源:https://stackoverflow.com/questions/6531683/how-to-find-where-the-user-tapped-on-the-screen-in-ios

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