I do not want my iPhone slider to return simple numbers like 1, 2, 3, etc. to the text label, but 15mm, 15.5mm, 16mm, etc., from 15mm to 45mm in increments of .5. So I thought I would put all the acceptable numbers in an array and link the slider output with the corresponding object in the array. (Slider returning "0" will link to the first element of the array, etc.)
Here is how I've tried to link the output to the array, and the warning it generated (line 5, for line 4):
How do I change the type from a number to a string (I think that's what will take away the warning)? I've been coding in Obj-C for the last three months, and came from a PHP background.
Thanks!
Steve
Here is how I've tried to link the output to the array, and the warning it generated (line 5, for line 4):
Code:
-(void)sliderAction:(id)sender{
NSArray *array = [NSArray arrayWithObjects: @"15", @"15.5", ..., @"45", nil];
NSString *labelValue; // This var will pass the value to the text label
labelValue = [array objectAtIndex:slider.value]; // Slider will pass a number from 0-59
// warning: passing argument 1 of 'objectAtIndex' makes integer from pointer without a cast
label.text = [NSString stringWithFormat:@"%02.0fmm", labelValue]; // The array number and "mm" will be sent to the text label
[labelValue release]; // release the memory
}
How do I change the type from a number to a string (I think that's what will take away the warning)? I've been coding in Obj-C for the last three months, and came from a PHP background.
Thanks!
Steve