예제 #1
0
        private void PinPhotoCoordinates(UILongPressGestureRecognizer gestureRecognizer)
        {
            var tapLocation    = gestureRecognizer.LocationInView(PhotoLocationMap);
            var pinCoordinates = PhotoLocationMap.ConvertPoint(tapLocation, PhotoLocationMap);

            _annotation.Coordinate = pinCoordinates;
            LongitudeLabel.Text    = pinCoordinates.Longitude.ToString("F5");
            LatitudeLabel.Text     = pinCoordinates.Latitude.ToString("F5");
        }
예제 #2
0
        private void SetupMapView()
        {
            _locationManager = new CLLocationManager();
            _locationManager.RequestWhenInUseAuthorization();

            _annotation = new MKPointAnnotation()
            {
                Title    = "Photo location",
                Subtitle = "Your photo location will be here"
            };

            NavigationController.NavigationBarHidden = false;
            PhotoLocationMap.ShowsUserLocation       = true;

            PhotoLocationMap.SetUserTrackingMode(MKUserTrackingMode.Follow, true);
            PhotoLocationMap.AddGestureRecognizer(new UILongPressGestureRecognizer(PinPhotoCoordinates));
            PhotoLocationMap.AddAnnotation(_annotation);
        }