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 8832139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:27:48+00:00 2026-06-14T08:27:48+00:00

Newbie obj-c question. I am writing a simple iPad presentation not for Appstore. My

  • 0

Newbie obj-c question.
I am writing a simple iPad presentation not for Appstore. My task is to implement few methods executed one after another with little pauses between them. Main structure looks like this:

  • view loads
  • two seconds pause, then executing method1
  • two seconds pause, then executing method2
  • two seconds pause, then executing method3
    etc…

First method I am calling from -viewDidLoad:

NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(firstCountStarts) userInfo:nil repeats:NO];

Everything is ok here, method starts 2 seconds after view loads.
From inside method1 I try to call method 2 in the same way but it start to execute simultaneously with method1. Same way triggered method3 (called from method2) and all methods after them not executed at all. I tried to situate all this methods in -ViewDidLoad and to call them with delays:

 [self method1];
 [self performSelector:@selector(method2) withObject:nil afterDelay:2];
 [self performSelector:@selector(method3) withObject:nil afterDelay:4];
 etc...

But after method2 is calling all methods after didn’t executed. If I understand right the issue in threads. Do I need to use GCD to execute methods in different queues? Or maybe problem in else?

Thanks, colleagues!

  • 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-14T08:27:49+00:00Added an answer on June 14, 2026 at 8:27 am

    You could add these to an NSOperation queue…

    NSOperationQueue *queue = [NSOperationQueue new];
    
    queue.maxConcurrentOperationCount = 1;
    
    [queue  addOperationWithBlock:^{
        [self method1];
    }];
    
    [queue  addOperationWithBlock:^{
        [NSThread sleepForTimeInterval:2.0];
        [self method2];
    }];
    
    [queue  addOperationWithBlock:^{
        [NSThread sleepForTimeInterval:2.0];
        [self method3];
    }];
    
    ...
    

    This will then run each one only after the previous one has finished and put the 2 second delay in for you.

    Careful about using this to do an UI stuff though. This will run in a Background thread so you may need to deal with that.

    Maybe this might work better you could do it by subclassing NSOperation but that’s a lot of work for not much benefit.

    Run this from where ever you want, I suggest putting all this into a function called setUpQueue or something.

    Then from viewWillAppear or viewDidLoad or somewhere else, on a button press, etc… do…

    [self setUpQueue];
    

    All you have to do is add stuff to the queue, the queue will then manage itself.

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

Sidebar

Related Questions

Newbie obj-c question. My task is to make visually represented test for iPad. In
Total newbie Iphone/ Obj. C question: I have a class called Location, in the
Good day, friends. Once again stupid question about Obj-C from newbie :) I'm trying
I am a newbie in Obj-C. I need to learn this better so please
HERE IS THE CODE: http://min.us/mWdMO0n14 I'm a Obj C newbie, so I've searched quite
I'm a newbie just begun with iPhone and Obj-C for a month now. I
Newbie question... The objective: I intend to have an HTML text input field as
Newbie question: I just installed VisualSVN Server and created a repository. I noticed that
Newbie question here. I'm in the beginning stages of laying out a site in
Newbie question: There are three types of Asp.Net controls : HTML server controls, Web

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.