Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

iphonedevelop18

macrumors member
Original poster
Feb 26, 2009
50
0
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

macrumors demi-god
Oct 16, 2006
825
9
Kentucky
Code:
- (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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.