Skip to main content

Set multiple markers and image on google map swift 3

 let locations = [
                    ["title": "Phase 11, Mohali", "latitude": 30.680177, "longitude": 76.745705],
                    ["title": "Phase 6, Mohali", "latitude": 30.735547, "longitude": 76.712071],
                    ["title": "Phase 106, Mohali", "latitude": 30.728100, "longitude": 76.717665]
                ]
        
                for location in locations {
                    let marker = GMSMarker()
                    marker.position = CLLocationCoordinate2D(latitude: location["latitude"] as! Double, longitude: location["longitude"] as! Double)
                  //  state_marker2.snippet = "Phase 106, Mohali."
                    marker.title = location["title"] as? String
                    //For image
//                    let markerImage = UIImage(named: "Web")!.withRenderingMode(.alwaysTemplate)
//                  let markerView = UIImageView(image: markerImage)
//                   marker.iconView = markerView
                    marker.map = gmsMapViewOut

                }

Comments

Popular posts from this blog

post method using alamofire in swift 3

  func addSubscriptionApi(_completeUrl: String ) {         //HUD         Alamofire.request(_completeUrl, method:.post, parameters: nil , encoding: JSONEncoding. default , headers: nil ).responseJSON { response in             switch (response.result) {             case .success( _ ):                 if let data = response.result.value as ? NSDictionary                 {                     print(response.result.value as Any)                     print(data)                      print("SUCCESS")                  }                 break  ...

Set Placeholder in UiTextView in swift 3

//In viewdidLoad add this                DiscriptionTV . text = "Discription"         DiscriptionTV . textColor = UIColor . lightGray         DiscriptionTV . delegate = self          DiscriptionTV . layer . borderColor = UIColor . lightGray . cgColor ; then   //Mark:- textView Delegates          func textViewDidBeginEditing( _ textView: UITextView ) {         if DiscriptionTV . textColor == UIColor . lightGray {             DiscriptionTV . text = nil             DiscriptionTV . textColor = UIColor . white             DiscriptionLab . isHidden = false         }     }          func textViewDidEndEditing( _ textView: UITextView ) { ...