Q:

Using NSMutableArray to get objects doesn't work?

So I created an NSMutableArray and inside it I put a UISlider. For some reason though, whenever I try to get its value, i.e.
[[sliderArray objectAtIndex:index] value];

it comes out as an NSString * but when I try
[slider value];

it comes out as a float. Any idea why this might be?

A:

The problem is that the compiler doesn't know what kind of object will be retrieved when you use objectAtIndex. You need to typecast the returned object so that it knows you're talking about a UISlider.
[(UISlider *)[sliderArray objectAtIndex:index] value];

