我添加UiSlider以编程方式查看如下:
UiSlider * sideslider = [[UiSlider alloc] initWithFrame:CGRectMake(canvasWidth +((canvasWidth) - (recwidth) / 4) /b2,recheight - 70,(recwidth) / 4,20)]; [sideslider setMaximumValue:solution0->Plan->hdivisions.count]; // sideslider int slidervalue = sideslider.value; [self addSubview:sideslider];
我需要添加此事件处理程序
-(IBAction)updateside:(UiSlider *)sender;
创建后到这个滑块?
解决方法
[slider addTarget:self action:@selector(updateside:) forControlEvents:UIControlEventValueChanged];