-1

I want to create a kind of touch recorder. I have an array with buttons and in forin i want to my app click button every second.

for(UIButtons *button in self.tmpRecord) {
        [button sendActionsForControlEvents: UIControlEventTouchUpInside];
        //wait a second
}

How can I do that?

Popeye
  • 11,839
  • 9
  • 58
  • 91

2 Answers2

0

Use an NSTimer to schedule events to be repeated every second.

This question has quite a few good answers: How do I use NSTimer?

Community
  • 1
  • 1
Adis
  • 4,512
  • 2
  • 33
  • 40
0

You can use NSTimer:

NSTimer* myTimer = [NSTimer scheduledTimerWithTimeInterval: 1.0f target: self selector: @selector(myMet:) userInfo: nil repeats: YES];



-(void) myMet:(NSTimer*) t 
{
    for(UIButtons *button in self.tmpRecord) {
        [button sendActionsForControlEvents: UIControlEventTouchUpInside];
        //wait a second
    }
}
Greg
  • 25,317
  • 6
  • 53
  • 62