Hello all,
Could somebody help me a little bit with my issue below?
When I call the myFunction, images which I want to set to buttons appear after 2 sec simultaneously, not one by one with delay of 0.5 sec.
More info:
- generatedNumbers is array with four elements of NSNumber (4,1,3,2)
- buttons are set in UIView via IB and are tagged (1,2,3,4)
-(IBAction) myFunction:(id) sender {
int i, value;
for (i = 0; i<[generatedNumbers count]; i++) {
value = [[generatedNumbers objectAtIndex:i] intValue];
UIButton *button = (UIButton *)[self.view viewWithTag:i+1];
UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"%d.png",value]];
[button setImage:img forState:UIControlStateNormal];
[img release];
usleep(500000);
}
}