I’m trying to set an object’s hidden property based on the existence of a key in a dictionary in my cell’s prepareForReuse method. I must be incorrectly using prepareForReuse. With the below code, it logs "Key exists at ..." when I scroll AWAY from the cell in which the object should be hidden. I expected it to log this as I was scrolling TOWARDS the cell. Nonetheless, my object is not being hidden.
-(void)prepareForReuse
{
NSDictionary *dictionary = [parseTrackArrayReference objectAtIndex:currentIndex];
if ([dictionary objectForKey: @"sliderEnabled"]) {
playbackSlider.hidden = NO;
NSLog(@"Key exists at index: %i", currentIndex);
}
else {
playbackSlider.hidden = YES;
}
}
Moved method body to cellForRow and it works fine.