title: Swift How to do when select map pin and show detail on tableView Cell
body: <p><strong>I'm new in swift developer and I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.</strong></p>
  <p><strong>I would like to do when I select the map pin that will show detail on tableView Cell.</strong></p>
  <p>Like this two photo</p>
  <blockquote>
  <p>This is photo1</p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/RZm9Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RZm9Y.png" alt="enter image description here" /></a></p>
  <blockquote>
  <p>and when I select the image will like photo2. Name,Address,TelNumber Label will show the Detail</p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/6xMB9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6xMB9.png" alt="enter image description here" /></a></p>
  <blockquote>
  <p>and I try to do this code but still didn't work</p>
  </blockquote>
  <pre><code>var dictRow = [String:String]()
  var dicRow = [String:[String:String]]()
  func getAddPin (){
          for index in arrTable{
              let Annotation = MKPointAnnotation()
              let bLatitude = index[&quot;Latitude&quot;] as! Double
              let bLongitude = index[&quot;Longitude&quot;] as! Double
              Annotation.coordinate = CLLocationCoordinate2DMake(bLatitude , bLongitude)
              Annotation.title = index[&quot;Name&quot;] as? String
              //writeing detail which pins is already make in map view 
              //I try use Annotation for key when I select pin can get value 
              PinName = [Annotation.title!]               //Name for key      
              dictRow[&quot;ClassType&quot;] = index[&quot;ClassType&quot;] as? String 
              dicRow[Annotation.title!] = dictRow        //write to dict           
              dictRow[&quot;City&quot;] = index[&quot;City&quot;] as? String
              dicRow[Annotation.title!] = dictRow
              dictRow[&quot;Area&quot;] = index[&quot;Area&quot;] as? String
              dicRow[Annotation.title!] = dictRow
              dictRow[&quot;Address&quot;] = index[&quot;Address&quot;] as? String
              dicRow[Annotation.title!] = dictRow
              dictRow[&quot;TelArea&quot;] = index[&quot;TelArea&quot;] as? String
              dicRow[Annotation.title!] = dictRow
              dictRow[&quot;Tel&quot;] = index[&quot;Tel&quot;] as? String
              dicRow[Annotation.title!] = dictRow
              myMapView.addAnnotations([Annotat
  }
  func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
          Pintouch = true
          tableView2.isHidden = false
          print(Pintouch)
          myMapView.frame = CGRect(x: 0, y: 215, width: DeviceWidth, height: DeviceHeight - 330)
          self.tableView2.reloadData()
        } 
  func mapView(_ mapView: MKMapView, didDeselect view: MKAnnotationView) {
          Pintouch = false
          tableView2.isHidden = true
          myMapView.frame = CGRect(x: 0, y: 35, width: DeviceWidth, height: DeviceHeight - 150)
      }
   func tableView(_ tableView: UITableView,cellForRowAt indexPath: IndexPath)-&gt; UITableViewCell {
          if  Pintouch == true {
              cell = tableView2.dequeueReusableCell(withIdentifier: &quot;MyCell&quot;, for: indexPath) as! ClintTableViewCell
              MapPinName = PinName[indexPath.item]
              dictRow = dicRow[MapPinName]!
              cell.MyCellName.text = MapPinName
              cell.MyCellCT.text = dictRow[&quot;ClassType&quot;]
              cell.MyCellCIty.text = dictRow[&quot;City&quot;]
              cell.MyCellArea.text = dictRow[&quot;Area&quot;]
              cell.MyCellAddress.text = dictRow[&quot;Address&quot;]
              cell.MyCellTelArea.text = dictRow[&quot;TelArea&quot;]
              cell.MyCellTelArea.text = cell.MyCellTelArea.text! + &quot;-&quot;
              cell.MyCellTelNum.text = dictRow[&quot;Tel&quot;]
  }
  </code></pre>
  <p>How can I do that? any ideas? cheers mate!</p>