Get value from a UISlider inside a Cell

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!

Answers


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.


Need Your Help

Using TFS Integration Platform (from codeplex) to move source to new instance

tfs tfsintegrationplatform

I have a TFS 2005 server and used the TFS Integration Platform (from codeplex) to do a 1 way migration from to a new 2010 instance. I expected the full history to come across but instead I just to a

binary search using recursion

c++ search binary

I can not figure out why this will not return the key, it seems to be skipping over the step, the logic i feel is straight, if midptr is less than key then search right else search left side. but i...