Questions tagged [mkpinannotationview]

MKPinAnnotationView implements an MKAnnotationView to display a push pin and is the only system-provided annotation view.

MKPinAnnotationView implements an MKAnnotationView to display a push pin and is the only system-provided annotation view. It is the pin used in the Apple Maps application and enjoys widespread use in third party apps as well. Red, green, and purple pins are the only pin colors supported as of iOS 6.

For more information, see the Apple Documentation for MKPinAnnotationView.

165 questions
0
votes
1 answer

How to show a view when a user clicks on pin annotation?

I am developing a project in which I have parse json data and save it into an array. From that array, I have make a UITableView in which I have a number of businesses. With the help of their latitude and longitude, I show them on an MKMapView. Now…
iRam11
  • 309
  • 4
  • 16
0
votes
1 answer

How add title on pin?

for(int i=0;i<[btv_view.aray_cord count];i++) { //dm.title=[appDelegate.lB objectAtIndex:i ]; [mapView addAnnotation:[btv_view.aray_cord objectAtIndex:i]]; } I have use above code for adding multiple pin annotation on map. Now i want add…
iRam11
  • 309
  • 4
  • 16
0
votes
1 answer

MKPinAnnotationView not moving

I have went through a few links here, not all of them, regarding MKPinAnnotationView pin, subclass, etc. I did some simple tutorials online and when I thought I could start on my application with the knowledge from the tutorials, I was wrong. :( In…
0
votes
2 answers

How to get latitude and longitude of a city?

I am designing a project in which I have used two text fields. One is for source address and another one is for destination address. Now, I want to get latitude and longitude of both addresses and then draw it on map view. How can I accomplish that?
0
votes
1 answer

SwiftUI - how can I have a long press gesture trigger an alert with text view and then drop an mkannotationpin with the text as it’s title?

very new to swiftUI but I couldn't find this answer anywhere. Thanks in advance. At the end of a LongPressGesture, I have this gesture recogniser method called, which executes fine. The only problem is I want to call showAlert() and wait for the…
0
votes
0 answers

Add action to the button in MKPinAnnotationView

tldr: I try to add actions with alerts to a button in pinView and store this data (names of pins with describtion and pin icon) in UserDefaults. I have pins with MKPinAnnotationView and a button in it. I would like this button to check if user is…
0
votes
1 answer

MKPinAnnotationView unable to set custom image

I have a MKPinAnnotationView and in my viewForAnnotation method, I do the following: customPinView.image = [UIImage imageNamed:@"blah.png"]; I have added blah.png to my resources (by dragging the file in) But I still see the stock pin and not my…
DeShawnT
  • 479
  • 2
  • 7
  • 12
0
votes
1 answer

Remove annotation when slider moves - swift

i have a problem with annotations that i can't resolve. When you click on a UIButton, the @IBAction pressPlay function starts, which causes the slider on my map to start moving. The slider has the max value 0 and min -31, and the initial value is 0…
0
votes
1 answer

mkmap crashing when trying to get distance from user location to pin on map

For some reason whenever i click on my pin the app crashes. there are no errors or warnings in my code. It only happens when i try to get the distance from userLocation to the pin. find my mistake? @implementation FirstViewController // Implement…
0
votes
1 answer

MKPinAnnotationView doesn't show in MKMapView even though it's properly added using Swift

I'm developing an OSX app. I've subclassed a MKAnnotation: import Foundation import MapKit class LocationAnnotation: NSObject, MKAnnotation { var image: NSImage? var title: String? var coordinate: CLLocationCoordinate2D init(image…
0
votes
2 answers

iOS swift MapKit, pins added from search callback handler not appearing on the map

so i've been learning iOS, and for my practice for MapKit, i have made an app that zooms in on my region and puts a pin at my location (geo coordinates given to the simulator), that all seems to be working and i can even see the pin... But next i am…
0
votes
1 answer

Cant set Custom Pin Image In MapView, Swift 3

Mini-Map Code: import UIKit import MapKit @IBOutlet weak var ProfileMapView: MKMapView! func mapView(_ ProfileMapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? { if annotation.isMember(of: MKUserLocation.self) { …
RandomGeek
  • 303
  • 5
  • 20
0
votes
2 answers

Custom MKPointAnnotation isn't responding to user interaction

I am making a Swift application that uses MKPointAnnotations, and I recently ran into an issue where I needed to store metadata in my annotations, so I created the custom class below: class BRETTFAnnotation: MKPointAnnotation { var tag: Int64 …
brettfazio
  • 1,136
  • 10
  • 25
0
votes
1 answer

Swift - Using a UISwitch to change Pin Color

I want to change the pin color from Red to Purple once the switch has been turned on. So far I have tried: @IBAction func SwitchChanged(_ sender: Any){ if LegacySwitch.isOn == true { annotation.pinTintColor = .purple } else { …
K. A.
  • 59
  • 3
  • 11
0
votes
1 answer

Setting custom image - MKPinAnnotationView - Swift 3

I'm using MapKit and I'm currently trying to set a custom pin annotation image on my pins. However, I'm having a hard time figuring out why it doesn't work. All of the other code is working perfectly, and when I try printing the frame of the image…
Frizzo
  • 432
  • 5
  • 10