views:

9

answers:

1

so I have an array with objects @"One", "Two", "Three", "Mouse" and I want to have each word of the array NSLog'ed to the console in half second increments. I also would like to be able to switch to 1 second increments instead. Can anyone please help me write this code. I'm new, but I need to understand this project.

I was tipped that I can use [NSThread sleepForTimeInterval:0.01]; but I dont know how i can do this... Thanks for your help! I know noobs are probably annoying, but I'm trying!

A: 

well. Someone just helped me thanks!

NSArray *food = [NSArray arrayWithObjects:@"Apples:",@"bacon",@"corn",@"donuts",@"elfs",@"fidge",nil];

// the number of seconds to wait between printing each item double secondsToSleep = 1.0;

for(int i = 0; i<6; i++){ [NSThread sleepForTimeInterval:secondsToSleep]; NSLog(@"item at index %i is %@",i,[food objectAtIndex:i]); }

if thats not the best way, let me know :)

Pete
Definitely not the best way; especially if you are on the main thread....
bbum