I am new to programming and to the iPhone. I am trying to recreate an app that I found in a book on iPhone programming as practice before I attempt to make an original app. This app has a slider and a label beside the slider that should change when the slider is moved. I am receiving 2 errors and a warning on 2 lines of code. Unused variable 'percentage' on one line and NSString may not respond to +stringWith and expected ] before format on another line. I'm sure this is something simple but I'm stuck and have no one to ask for help. Any help would be greatly appreciated.
The first error is on the line that starts int percentage. The next 2 are on the line [NSString stringWithFormat
"%i%%", percentage];
Code:
// determine if customPercentSlider generated the event
else if (sender == customPercentSlider)
{
// the "Custom" slider was moved
// round the value to a whole number
int percentage = (int)(customTipPercent * 100);
//update the label with the new percentage followed by %
customPercentLabel.text =
[NSString stringWithFormat:@"%i%%", percentage];
// convert percentage back to float and assign to Slider's value
float newSliderValue = newSliderValue;
customPercentSlider.value = newSliderValue;
// slider Thumb moved; update customTipPercent
customTipPercent = newSliderValue;
} // end else
The first error is on the line that starts int percentage. The next 2 are on the line [NSString stringWithFormat