I have a tableView
with custom cells in it, each cell has a UISlider
.
Now I want to create a method to get the values of those UISliders
, but I don't know how to access each cell and its slider value.
Thanks in advance!
First add a tag to each slider so you no which slider is which:
slider.tag = 0 //Can be any unique integer
Then register a method for slider changes:
[slider addTarget:self action:@selector(sliderUpdate:) forControlEvents:UIControlEventValueChanged];
Finally in your method
-(void)sliderUpdate:(UISlider *)sender {
int value = sender.value;
int tag = sender.tag;
}
Tag will now be the same unique integer you used before. It is a way of identifying the element.