How to insert a new Row in bottom of the UITableView Swift

后端 未结 4 1307
傲寒
傲寒 2021-01-12 18:10

I use

func insertRowsAtIndexPaths(indexPaths: [NSIndexPath],
withRowAnimation animation: UITableViewRowAnimation)

method to insert a new Ro

4条回答
  •  情话喂你
    2021-01-12 18:59

    func insertRowsAtIndexPaths(indexPaths: [NSIndexPath],
    withRowAnimation animation: UITableViewRowAnimation)
    

    It is the method for appending the rows. For inserting rows at bottom you need to give indexpath of the last row.

    For Example:

    var IndexPathOfLastRow = NSIndexPath(forRow: self.array.count - 1, inSection: 0)
    self.tableView.insertRowsAtIndexPaths([IndexPathOfLastRow], withRowAnimation: UITableViewRowAnimation.Left)
    

提交回复
热议问题