Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8234831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:37:01+00:00 2026-06-07T18:37:01+00:00

ok, so i have an array of strings of several methods that i want

  • 0

ok, so i have an array of strings of several methods that i want to run each in 2 second intervals.
i can’t figure out how to do this tho, I’ve tried using a forward loop however like this:

SEL methods;
NSTimer *timerBetweenMethods;
for (int i=0;i<[self.arrayOfStringsOfMethods count];i++{
methods=NSSelectorFromString([self.arrayOfStringsOfMethods objectAtIndex:i]);
timeBetweenMethods=[NSSTimer scheduledTimerWithInterval:2 target:self selector:methods userInfo:nil repeats:NO];
}

so say i have 10 methods in that array, what i want to happen is for the first method to run, then 2 seconds after the second, then 2 seconds after the third, etc… until the 10th for a total of 20 seconds to do this. However, what actually happens is after 2 seconds all the methods run at the same time, and i think this is because this forward loop is just quickly setting the timer, but not waiting until the timer does its method before looping again, which i guess makes sense, but how can i get my program to do what i want?
o, and btw I just learned about NSTimer today so I’m very new to it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:37:03+00:00Added an answer on June 7, 2026 at 6:37 pm

    You’re scheduling them all for the same time, as you note. Set your interval to 2*(i+1) rather than just 2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of strings that I want to use for button titles
I have an array constructed out of several strings (HTTP addresses) on which I
In Java, the java.util.Arrays class have several static toString(...) methods that take an array
I have an array of strings. How can I convert it to System.Collections.ArrayList?
I have an array of strings: @array I want to concatenate all strings beginning
I have an array of strings plus one additional string. I want to use
I want to call an overloaded callback method that can accept several different types
I have several methods that do the same thing yet, when interfacing with the
I'm using CakePHP to output an array that contains several UTF-8 encoded strings. I
I have this ViewModel to represent each Category and it's several Sub-Categories in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.