开发者

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

开发者 https://www.devze.com 2023-03-16 04:24 出处:网络
I want to find where user tapped on MapKit. I cannot find a action to make a connection so i a开发者_开发知识库m wondering there is an alternate method for the same. please let me know.As @Disco S2 sa

I want to find where user tapped on MapKit. I cannot find a action to make a connection so i a开发者_开发知识库m wondering there is an alternate method for the same. please let me know.


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


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

0

精彩评论

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

关注公众号