Когда я обновляю координаты аннотации, движется только маркер, заголовок остается на прежнем месте, вот часть, где я обновляю координаты:
for annotation in self.mapView.annotations
{
if let ann = annotation as? Artwork
{
if user.id == ann.id
{
if ann.coordinate.latitude != user.latitude! && ann.coordinate.longitude != user.longitude!
{
let userCoordinates = CLLocationCoordinate2D(latitude: user.latitude!, longitude: user.longitude!)
ann.coordinate = userCoordinates
}
}
}
}
Вот мой класс художественных работ:
import Foundation
import MapKit
class Artwork: NSObject, MKAnnotation
{
let title: String?
dynamic var coordinate: CLLocationCoordinate2D
let id: Int
init(title: String, coordinate: CLLocationCoordinate2D, id: Int)
{
self.title = title
self.coordinate = coordinate
self.id = id
super.init()
}
}
Есть ли у кого-нибудь представление о том, почему название остается в прежнем месте?