Refresh tableview after delete a tableview cell and refresh view controller

ぐ巨炮叔叔 提交于 2019-12-06 11:47:47

Well , First of all, if you want to refresh the tableview data you must notify it, so it knows if there are any changes in the model. If you want to reload the whole table view (I strongly advised not to do it) you can use

 tableView.reloadData()

If you want to refresh certain rows use the following methods:

tableView.reloadRowsAtIndexPaths(paths, withRowAnimation: UITableViewRowAnimation.None) 

Or you could use this method only for delete action. Observe the tap on button event and send signal to the tableView to delete the row. When the tableView receive this signal, just pass execute the following method.

 tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Automatic)

forcing redraw of your custom view : view.setNeedsDisplay()

Reload tableview data

[_tableView reloadData];

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!