Iphone自定义滑块双向移动

时间:2013-01-25 09:44:15

标签: ios

* In Ios custom slider? 如何在iphone中制作这种类型的自定义滑块,可以从左侧和右侧延伸?

2 个答案:

答案 0 :(得分:2)

请完成此示例项目..它可能满足您的要求..

CheckThis

只需导入AS RangeSlider类 并使用此代码..

ASRangeSlider *slider1 = [[ASRangeSlider alloc] initWithSpectrum:FloatRangeMake(0.0,f)];
[slider1 setThumbBackgroundImage:[UIImage imageNamed:@"GreenImage.png.png"]];
frame.size = self.BlackBackGround.frame.size;
slider1.frame = frame;
[BlackBackGround addSubview:self.slider1];
[slider1 addTarget:self action:@selector(slider1ValueChanged:) forControlEvents:UIControlEventValueChanged];
slider1.value=FloatRangeMake(0.0,f);

并且

-(Void) slider1ValueChanged : (id) sender
{
    CGRect changedFrame = slider1.activeAreaView.frame; // this is your changed frame
    // change the frames of your green image using this frame
}

答案 1 :(得分:0)