开发者

shake application, iPhone

开发者 https://www.devze.com 2023-02-24 14:27 出处:网络
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 m

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
  }

}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号