2

I am using mkmapview in my app. I am showing annotation in my app. But annotation title is not showing in my map view. Here is my code:

func loadMaps(){

   let shopsArray = self.locationlatlong as NSArray
    print(shopsArray)


    for shop in shopsArray  {
        let annotation = MKPointAnnotation()
        let mylatitude : String = shop["letitude"] as! String
        let string = NSString(string: mylatitude)
        let mylatitudeFinal = string.doubleValue

        print(mylatitude)
        print(mylatitudeFinal)
        let mylongitude : String = shop["longitude"] as! String
        let string123 = NSString(string: mylongitude)
        let mylongitudeFinal = string123.doubleValue



        let location = CLLocationCoordinate2D(
            latitude: mylatitudeFinal,
            longitude: mylongitudeFinal
        )

        print(location)
        annotation.coordinate   = location
         annotation.title  = shop["firstname"] as? String
        mapView?.addAnnotation(annotation)


    }

So how can I show annotation title in my map?

Mirza Sisic
  • 2,401
  • 4
  • 24
  • 38
Jack.Right
  • 974
  • 3
  • 14
  • 30

0 Answers0