user531
user531

Reputation: 47

shake application, iPhone

I have an application 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

Upvotes: 0

Views: 265

Answers (1)

Felix
Felix

Reputation: 35384

-(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
  }

}

Upvotes: 1

Related Questions