So after calling the remove function from the API, here comes the question, how do you refresh the table view's content.
Firstly, create a protocol method in your cell class
protocol BookingTableViewCellDelegate {
func reloadTableViewData()
}
then
var delegate: BookingTableViewCellDelegate?
in table view controller
func reloadTableViewData() {
println("reloading data")
self.items.removeAllObjects()
getBookings()
self.myBookingTableView.reloadData()
}
and add
cell.delegate = self at cellForRowAtIndexPath
then finally, in your cell class:
self.delegate?.reloadTableViewData()
No comments:
Post a Comment