Reload tableView Abschnitt ohne Kopfzeile neu laden - Swift

Ich versuche neu zu laden tableView Abschnitt statt Neuladen der gesamten tableview, denn ich habe ein textfield in dem header-Abschnitt und wenn ich rufe self.tableView.reloadData() meine Tastatur gesperrt.

Ich habe versucht den code unten, aber ich bekomme diese Fehlermeldung Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to delete row 5 from section 2 which only contains 4 rows before the update' Also bitte, wo wäre dann mein Problem?

    let newCount = self.placeArray.count

    var newIndexPaths = NSMutableArray(capacity: newCount)

    for var i = 0 ; i < newCount ; i++ {
    var indexPath = NSIndexPath(forRow: i, inSection: 2)
        newIndexPaths.addObject(indexPath)
    }

    self.tableView.beginUpdates()
    self.tableView.reloadRowsAtIndexPaths(newIndexPaths as [AnyObject], withRowAnimation: UITableViewRowAnimation.None)
    self.tableView.endUpdates()

InformationsquelleAutor der Frage CAN | 2015-09-07

Schreibe einen Kommentar