title: Use beginUpdates/endUpdates for deleting row from tableview
body: <p>Deleting a row from tableview using <code>beginupdates</code>/<code>endupdates</code> instead of <code>reloadData</code>.</p>
  
  <pre><code> viewTeachertblView.beginUpdates()
   let indexPath = NSIndexPath(forRow: sender.tag, inSection: 0)
   self.viewTeachertblView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.None)
   viewTeachertblView.endUpdates()
  </code></pre>
  
  <p>This method doesnot work as <code>cellForRowAtIndexPath</code> is not called and <code>indexpath</code> gets out of track while deleting.</p>
  
  <p>Here is the full source code:</p>
  
  <pre><code>extension ViewController :UITableViewDataSource,UITableViewDelegate{
  
      func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
  
          return teacherObj.count
      }
  
      func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
  
          return 1
      }
  
      func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
  
          let cell = tableView.dequeueReusableCellWithIdentifier("teacherCell", forIndexPath: indexPath) as! TeacherTblVIewCell
          print(teacherObj[indexPath.row].valueForKey("teacher_name") as? String)
          cell.teacherName?.text = teacherObj[indexPath.row].valueForKey("teacher_name") as? String
          cell.deleteBtn.tag = indexPath.row
          cell.deleteBtn.addTarget(self, action: "deleteThisTeacher:", forControlEvents: UIControlEvents.TouchUpInside)
          return cell
  
      }
  
  
      func deleteThisTeacher(sender:UIButton){
  
          print("delete this username")
          //first delete this user name from the coredata
          print(sender.tag)
          teacherObj.removeAtIndex(sender.tag)
         // self.viewTeachertblView.reloadData()
          viewTeachertblView.beginUpdates()
          let indexPath = NSIndexPath(forRow: sender.tag, inSection: 0)
          self.viewTeachertblView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.None)
          viewTeachertblView.endUpdates()
  
  
      }
  
  }
  </code></pre>
  
  <p>How to delete tableview row the <code>beginupates</code>/<code>endupdates</code> instead of deleting object from the <code>datasource</code> and reloading <code>tableview</code></p>