i am making an app in which i am creating UIslider programmaticaly and i am changing label value according to the value of uislider,now i want that While sliding, the value should slide aswell as showing in figure below.How it can be done. For good explanation i am attaching a screen shot so u people can better understand it.
below is my code:
-(void)viewdidload
{
CGRect frame = CGRectMake(150, 230, 300.0, 10.0);
radius = [[UISlider alloc] initWithFrame:frame];
[radius addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged];
[radius setBackgroundColor:[UIColor clearColor]];
radius.minimumValue = 10.0;
radius.maximumValue = 300.0;
radius.continuous = YES;
radius.value = 10.0;
CGAffineTransform trans = CGAffineTransformMakeRotation(M_PI_2);
radius.transform = trans;
//self.label.text = [NSString stringWithFormat:@"%f", 10];
[self.view addSubview:self.mapView_];
[self.view insertSubview:radius aboveSubview:self.mapView_];
}
-(void)sliderAction:(id)sender
{
_SliderDefaultValue=radius.value;
NSLog (@"the slider value ==%f",_SliderDefaultValue);
self.label.text = [NSString stringWithFormat:@"%f", _SliderDefaultValue];
}
thanx in advance
try this tutorial will resolve your issue