Kevin Maldjian
Kevin Maldjian

Reputation: 147

Swift Removing the "My Location" Annotation on MKMap View

Problem:

I am looking to suppress touch to the user location in efforts to block the "My Location" annotation


I have been looking for a solution for a while now and after extensive online research I have yet to find this question even posted.

I have created a mobile application written in Swift where there are notes on the MKMap View. The issue I am running into is when a user selects a note that they are near, It sometimes displays this "My location" annotation as apposed to displaying the correct note.

Im sure there is way to block this annotation and I have written a statement that helps me identify the pop-up

        if (((view.annotation?.title)!)! == "My Location"){
            print("wrong annotation selected")

Is there any way to disable touch to the user location icon?

I have already changed the color of the circle using

map.tintColor = UIColor(red:0.19, green:0.69, blue:0.73, alpha:1.0)

So I was thinking there might be like a

map.UserLocationTouch = false 

or something along those lines.

Looking to remove this pop-out

Upvotes: 3

Views: 1627

Answers (2)

G Clovs
G Clovs

Reputation: 3122

Hey there is an updated easy solution on:

.Net for iOS (Xamarin.iOS)

NativeMap.UserLocation.Title = "";

Swift:

mapView.userLocation.title = "";

Regards ;)

Upvotes: 0

Nicolas
Nicolas

Reputation: 538

mapView.userLocation.title = ""

And the annotation will not appear when you press.

Upvotes: 6

Related Questions