I was going to post this as a Question but I worked it out and thought I'd share it in case anyone else ran into this.
I have a custom tableViewCell called SliderCell. I use a number of SliderCells on my table.
The SliderCell contains a UISlider and a UILabel.
When the user moves the slider the label is updated with a new value
This is in this method
- (IBAction)possibilityDidChange:(UISlider *)sender {
Now the sender in this case is the UISlider control
To set the value of UILabel I needed to get the tableviewCell (sliderCell) that the sender sits on.'
Originally i got this as follows
SliderCell *theAnimalCell =(SliderCell*)sender.superview.superview;
I could then set the label like this
theAnimalCell.sliderLabel.text = [NSString stringWithFormat:@"turtles %@",possibilityString];
All well and good when i was using Xcode 4.x and targeting iOS6.1
Now , after deciding that 200m+ cant be wrong I'm just targeting iOS 7 and suddenly I'm getting a crash as sooon as I touch any of my UISliders
I get this error
[UITableViewCellScrollView currentSlider]: unrecognized selector sent to instance
I couldn't find any reference to this class in the documentation.
Inspecting the class i discovered what i was expecting to be a SLiderCell was in fact now a UITableViewCellScrollView. However if you go up another level by adding an extra .superview you do get to the custom UITableViewCell and it now works again
So the change was from
SliderCell *theAnimalCell =(SliderCell*)sender.superview.superview;
To this
SliderCell *theAnimalCell =(SliderCell*)sender.superview.superview.superview;
I guess if you wanted to support both iOS 7 and iOS 6 you would need to check before you tried to grab the custom cell.
Well, thats it , hope this proves useful to someone out there.
Simon