I have an appli开发者_开发技巧cation which starts the timer when the shake begins and stops when the shake ends. I need to modify this. I need to shake it for 4 times and after each shake, the value must be pushed into an array. So at the end, after the 4 shakes , the 4 timer values must be saved into a single array. Can this be done? I am trying to figure it out but am kinda stuck.
Anu kind of help will be greatly appreciated. Thanks in advance
-(void) shakeEnded {
NSTimeInterval time = ... // get the time interval like in your first app
// add the time to a NSMutableArray
[self.timerArray addObject:[NSNumber numberWithDouble:time]];
if ([self.timerArray count] == 4) {
// do something
}
}
精彩评论