title: How add cells in UITableView on button click?
body: <p>I have a <code>UITableView</code>.It has two custom prototype cells.Now one cell is fixed it will be just remain one in tableview but another cell will be added to tableview again &amp; again on button click.</p>
  
  <p>below is code for the tableview methods:</p>
  
  <pre><code>func numberOfSections(in tableView: UITableView) -&gt; Int {
      return 2
  }
  
  func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      return arr_fields.count
  }
  
  func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
      if indexPath.section == 0 {
          let cellIndentifier="property"
  
          let cell:CreatePropertyCell=tableView.dequeueReusableCell(withIdentifier: cellIndentifier, for: indexPath) as! CreatePropertyCell
          cell.layer.borderWidth = 2.0
          cell.layer.borderColor = UIColor.gray.cgColor
          cell.txt_propertyName.attributedPlaceholder = NSAttributedString(string:"Name of property",
                                                                           attributes:[NSForegroundColorAttributeName: UIColor.gray])
  
          return cell
  
      } else {
          let cellIdentifier = "attribute"
          let cell:AddProperty=tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as! AddProperty
          cell.layer.borderWidth = 2.0
          cell.layer.borderColor = UIColor.gray.cgColor
          cell.txt_AddProperty.attributedPlaceholder = NSAttributedString(string:"Property Attribute",
                                                                          attributes:[NSForegroundColorAttributeName: UIColor.gray])
          cell.btnAdd.tag=indexPath.row
          return cell
  
      }
  }
  
  func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -&gt; CGFloat {
      return 15
  }
  
  func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -&gt; UIView? {
  
      let header = UIView()
      header.backgroundColor = UIColor.clear
      return header
  
  }
  
  @IBAction func actionAddProperty(_ sender: AnyObject) {
      let cellIdentifier = "attribute"
      let cell:AddProperty = self.tableView.dequeueReusableCell(withIdentifier: cellIdentifier) as! AddProperty
      cell.layer.borderWidth = 2.0
      cell.layer.borderColor = UIColor.gray.cgColor
      cell.txt_AddProperty.attributedPlaceholder = NSAttributedString(string:"Property Attribute",
                                                                      attributes:[NSForegroundColorAttributeName: UIColor.gray])
      cell.tag=sender.tag!+1
      arr_fields.append(cell)
      tableView.reloadData()
      print("tag is \(sender.tag!)")
  }
  </code></pre>
  
  <p>Now i just want to add second cell to the table view not the both the cells.As of now it adds both the cells to the table view.</p>