I'm trying to create a function that changes a lab开发者_开发技巧el's text. I want it in a "Wheel of Fortune" style where the text changes really quickly at first but slows down over time, then stops at the final text. I have the text as strings in an array.
I'm guessing I would need an exponential function to do this but maths is not my strong point. Currently I'm trying:
- (void)timer {
float time = 0.5;
float increase = 0.05;
for(int x = 0; x < 100; x++) {
sleep(time);
time = time + increase;
NSLog(@"%f", time); //Log to show time of each iteration
}
}
I don't need help linking it up with labels etc., I just need help to get the timing right.
精彩评论