iOS - UISlider - How to make a slider to auto-move [closed]
- by drodri420
its me again.
Coming back with another noobish question:
This time its , can you make a UISlider move by itself???
I've implemented this on the .m
///This right here makes a slider move 1point from 1 to 100, once it reaches 100 it goes backwards and so on...
- (IBAction)moveSlider:(UISlider *)sender
{
int flag=0, counter=1;
while(flag == 0)
{
counter = counter + (.25 * round);
if(counter == 100)
{
flag = 1;
}
if(counter < 100 && counter > 1)
{
slider.value = counter;
}
}
while(flag == 1)
{
counter = counter - (.25 * round);
if(counter == 1)
{
flag = 0;
}
if(counter < 100 && counter > 1)
{
slider.value = counter;
}
}
}
And Implemented this on another action:
-(void)startNewRound
{
round+=1;
targetValue = 1 + (arc4random() % 100);
self.slider.value = currentValue;
[self moveSlider:slider];
}
I think I lost it along the way and Im just typing pure nonsense but If anyone could point me in the right direction on to which is it that Im doing wrong??