Repeating task

Discussion in 'iOS Programming' started by lynkynpark86, Jun 18, 2011.

  1. lynkynpark86 macrumors 6502

    I have an array with about 30 items. I also have a method that creates a file in a directory with the name based off a string. I need to repeat the method several times, once for each item of the array, until it's done. This is basically what is is (I realize createDirectory won't work, it's just to make the example shorter):
    - (void)theMethod {
    How could I get that to work, once for each item in the array, loading the array item to the %@? Ideas? Please?
  2. MorphingDragon, Jun 18, 2011
    Last edited: Jun 18, 2011

    MorphingDragon macrumors 603


    Mar 27, 2009
    The World Inbetween
    You need to go back and learn your programming basics if you don't know how to access each item in an array. You use a type of loop.
  3. ViviUO macrumors 6502

    Jul 4, 2009
    I think a for loop will suit you nicely.

    Here is a basic overview: for loops
  4. forum user macrumors regular

    Aug 28, 2008

    Better that remembering the syntax of the classic for loop. Even if you need a counter, a friendly counter++ will do the job nicely.

    - Olaf

Share This Page