Your problem is that you first query the switch via its tag:
UISwitch *newsSwitch = (UISwitch *) [cell viewWithTag:101];
But later on, you change that tag:
[newsSwitch setTag:indexPath.row];
So when the cell gets reused, the switch won't be found as now its tag isn't 101 any more. Therefor, the switch will be stuck in its old state.
You can easily verify this by adding a NSLog(@"Switch: %@", newsSwitch);
after querying the switch. You'll see that it'll output Switch: (null)
for those rows where you have "wrong" switch values.
The solution this is to not modify the tag.
Question is, how do you remember which row the switch is for, then? One way would be this:
- (void)didChangeStateForSwitch:(id)sender
{
NSIndexPath *indexPath = [myTableView indexPathForCell:[sender superview]];
...
}
Another possibility is to use associated objects.