View Full Version : Help with labels and sliders
iphonedevelop18
Mar 1, 2009, 07:55 PM
I am having trouble with outputting the value of a slider in a text format. So how do i get it so when i move the slider the label outputs the sliders value?
KoolStar
Mar 1, 2009, 09:34 PM
- (IBAction)sliderChanged:(id)sender
{
UISlider *slider = (UISlider *)sender;
int progressAsInt = (int)(slider.value + 0.5f);
NSString *newText = [[NSString alloc] initWithFormat:@"%d", progressAsInt];
sliderLabel.text = newText;
[newText release];
}
This gets the value of of the slider and sets the value to a label text. You would fire this IBAction from the Value Changed Outlet of the Slider Control
iphonedevelop18
Mar 1, 2009, 09:44 PM
thanks so much
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.