ios - Wrong cells update in UITableView while scrolling -


I have a simple app that shows public transportation on the map. There is a facility to enable / disable specific specific transport routes on the map. This is a list in UITableView , in each cell there is a name of the path and there is a check signal that shows that a route is enabled or disabled. The problem occurs when I tap on the cell below the list I'm (so, the check mark appears, so the route is enabled), and then I scroll up and down the list several times, after that the check sign on the first tape cell disappears, I know No why but why The check mark disappeared, the proper route is enabled, its problem is known, it seems that the problem is in my receipt of the tableView: cellForRowAtIndexPath: my UITableViewController method of the preferred category . Here it is:

  - (UITableViewCell *) TableView: (UITableView *) Table View CellForAind Pound: (NSIndexPath *) index path {NSString * cellIdentifier = @ "cell"; FilterTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier: for cellIdentifierIndexPath: indexPath]; BOOL is checked; If (indexPath.section == 1) {cell.routeLabel.text = trollRoutes [indexPath.row]; // array of path names cell.directionLabel.text = trolldirections [indexPath.row]; // Another array of root names. Cell. Check = troll check [indexPath.row]; // trollCheck is the array of values ​​BOOL, each value means that the route has been enabled or disabled cell.checkedLabel.text = cell.isChecked? @ "✓": @ ""; } // For the same tram, we are reading the value from other arrays, it displays first, and there is no problem with it (indexPath.section == 0) {cell.routeLabel.text = tramroutes [indexPath. Row]; Cell.directionLabel.text = tramDirections [indexPath.row]; Cell.isChecked = tramCheck [indexPath.row]; Cell.checkedLabel.text = cell.is checked? @ "✓": @ ""; } Return cell; }  

When I scroll the table, the values ​​of trollcheck do not change what is wrong with my code?


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -