MKMapVIew - Connector for connection to a connection point

I am trying to locate a crane location on MKMapVIew to place a pin in this place. Is there any event that I can record that will give me this information?

+4
source share
2 answers

Here is the answer translated into MonoTouch in C #

Add this to the ViewController where MKMapView is located

public override void ViewDidLoad () { base.ViewDidLoad (); UILongPressGestureRecognizer sgr = new UILongPressGestureRecognizer (); sgr.AddTarget (this, new MonoTouch.ObjCRuntime.Selector ("LongPressGesture")); sgr.MinimumPressDuration = 1f; sgr.Delegate = new LongPressRecognizerDelegate (); this.View.AddGestureRecognizer (sgr); } [Export("LongPressGesture")] public void Handle (UIGestureRecognizer recognizer) { //http://freshmob.com.au/mapkit/mapkit-tap-and-hold-to-drop-a-pin-on-the-map/ //and //http://inxunxa.wordpress.com/2011/03/10/monotouch-longpress/ if (recognizer.State != UIGestureRecognizerState.Began) return; // get the point of the action PointF point = recognizer.LocationInView (this.View); CLLocationCoordinate2D coord = this.map.ConvertPoint (point, this.map); //Add pin annoation here LocationAnnotation ann = new LocationAnnotation (new LocationEntity (coord)); this.map.AddAnnotation (ann); } public class LongPressRecognizerDelegate : MonoTouch.UIKit.UIGestureRecognizerDelegate { public override bool ShouldReceiveTouch (UIGestureRecognizer recognizer, UITouch touch) { return true; } } 
+8
source

All Articles