This is the code:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let selectedItem = items.objectAtIndex(indexPath.row) as String
let itemId = selectedItem.componentsSeparatedByString("$%^")
//itemId[1] - Item Id
}
func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
let selectedItem = items.objectAtIndex(indexPath.row) as String
let itemId = selectedItem.componentsSeparatedByString("$%^")
//itemId[1] - Item Id
}
How to add Item Id "in Array or in String or something else..."? When you select rows 0,1,4,5 for example you have different Item Ids added "in Array or in String" and then when I want to deselect them how to deselect exact Item Id from the indexPath.row that is deselected and find it "in Array or in String or something else..." and deleted it ? Sorry for my broken english if you have a questions ask in comments and I will explain if I can
You could do this pretty simply by adding a
Dictionary
property to your table view controller:For Swift 3.0, use