Insert the indexpath row in iOS swift and Objective C
Solution:
If you want to add the index in the row without reloading the entire tableView then use the below code.
Swift:
tableView.beginUpdates()
tableView.insertRows(at: [IndexPath(row: yourArray.count-1, section: 0)], with: .fade)
tableView.endUpdates()
If you want to add the index in the row without reloading the entire tableView then use the below code.
Swift:
tableView.beginUpdates()
tableView.insertRows(at: [IndexPath(row: yourArray.count-1, section: 0)], with: .fade)
tableView.endUpdates()
Objective C:
[self. tableView beginUpdates];
NSArray *arr = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:Yourarray.count-1 inSection:0]];
[self. tableView insertRowsAtIndexPaths:arr withRowAnimation:UITableViewRowAnimationAutomatic];
[self. tableView endUpdates];
Comments
Post a Comment