title: Swift UITableView didSelectRowAtIndexPath in multipleSection and multiple prototype cells
body: <p>I have a question about UITableView. I want to build a table with the first row is static cell where I use UIWebView to play video. The other rows below will be a list of videos. When I click on the video in the list, I want to play it at the first row.</p>
  
  <p>Can anyone help me to set up the function didSelectRowAtIndexPath for this situation? Thank you very much.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
  
      if indexPath.section == 0 {
          let cell2 = tableView.dequeueReusableCellWithIdentifier("staticCell", forIndexPath: indexPath) as! staticCell
          let htmlString = "&lt;video width='100%' webkit-playsinline controls autoplay &gt;&lt;source src= 'http://203.162.121.235:1935/live/tranhieuapt.rqv3-1d9w-hx44-5y3m/playlist.m3u8'&gt;&lt;/video&gt;"
          cell2.videoView.loadHTMLString(htmlString, baseURL: nil)
          return cell2
      } else if indexPath.section == 1 {
          let cell = tableView.dequeueReusableCellWithIdentifier("dynamicCell", forIndexPath: indexPath) as! dynamicCell
          // Get data function
          func getDataFromUrl(url:NSURL, completion: ((data: NSData?, response: NSURLResponse?, error: NSError? ) -&gt; Void)) {
              NSURLSession.sharedSession().dataTaskWithURL(url) { (data, response, error) in
                  completion(data: data, response: response, error: error)
                  }.resume()
          }
          // Download Image Function
          func downloadImage(url: NSURL){
              getDataFromUrl(url) { (data, response, error)  in
                  dispatch_async(dispatch_get_main_queue()) { () -&gt; Void in
                      guard let data = data where error == nil else { return }
                      cell.thumnail.image = UIImage(data:data)
                  }
              }
          }
          let vid = videoArray[indexPath.row]
  
          cell.titleLb.text = vid.vidTitle
          cell.viewLb.text  = vid.vidView
          cell.dateLb.text  = vid.vidDate
  
  
          let encodedUrl = vid.vidThumb.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())
          if let checkedUrl = NSURL(string: encodedUrl!) {
              cell.thumnail.contentMode = .ScaleAspectFit
              downloadImage(checkedUrl)
          }
  
          return cell
      }
      let cell = UITableViewCell()
      return cell
  }
  </code></pre>