title: how to expand or replace the cell with another cell, when an particular cell select in table view
body: <p>I have already asked this doubt/problem in SO. but not get get solution. Please help me out....</p>
  <p>i have one table view which will show the list of name data till 10 datas. But what i need is , when user press any cell, that cell should be replace with another cell, which have some image, phone number, same data name. How to do that.</p>
  <p>I have two xib : <code>1. normalcell, 2. expandable/replace cell</code></p>
  <p>Here is my <code>viewconrolelr.swift</code></p>
  <pre><code>import UIKit
  
  class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
      
      
      @IBOutlet weak var tableView: UITableView!
      
      @IBOutlet weak var Resultcount: UILabel!
      
      var tableData = [&quot;thomas&quot;, &quot;Alva&quot;, &quot;Edition&quot;, &quot;sath&quot;, &quot;mallko&quot;, &quot;techno park&quot;,... till 10 data]
      let cellSpacingHeight: CGFloat = 5
  
      override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view, typically from a nib.
       
          var nib = UINib(nibName:&quot;customCell&quot;, bundle: nil)
          tableView.registerNib(nib, forCellReuseIdentifier: &quot;cell&quot;)
          Resultcount.text = &quot;\(tableData.count) Results&quot;
          
          
          
      }
      func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
           return self.tableData.count
      }
      
      func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return 1
      }
      func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -&gt; CGFloat {
          return cellSpacingHeight
      }
      
      // Make the background color show through
      func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -&gt; UIView? {
          let headerView = UIView()
          headerView.backgroundColor = UIColor.clearColor()
          return headerView
      }
      
      func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
       
          
          var cell:customCell = self.tableView.dequeueReusableCellWithIdentifier(&quot;cell&quot;) as! customCell
          
          
          cell.vendorName.text = tableData[indexPath.section]
          
          return cell
          
          
      }
  
  
    
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
  
  }
  </code></pre>
  <p>Starting my cell will look like this :</p>
  <p><a href="https://i.stack.imgur.com/ngeS9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ngeS9.png" alt="enter image description here" /></a></p>
  <p>When i press that cell, i need some thing to do like this with replace ment of like below cell :</p>
  <p><a href="https://i.stack.imgur.com/JRgzI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JRgzI.png" alt="enter image description here" /></a></p>
  <p>But when i press same cell again, again it should go to normal cell.</p>
  <p>How to do that ??</p>