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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:13:13+00:00 2026-05-31T09:13:13+00:00

I am currently making an objective c program in which there are 4 shapes

  • 0

I am currently making an objective c program in which there are 4 shapes on the screen. The shapes must be highlighted based on a sequence of ints, and only one shape must be highlighted at a time. Thus, I must add a delay after each shape has been highlighted. Using ‘sleep’ causes the program to have very strange behavior, and the only other way I can think of delaying it would be using ‘performSelector:withObject:afterDelay:’ but the the method I wish to pass as the selector takes a number of arguments, which it will not allow.

So my question is this: is it possible to pass a method with a number of arguments into ‘performSelector:withObject:afterDelay?’ If not, what other ways are there to add a delay to the program without sleeping a thread?

Any help is appreciated.

  • 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-05-31T09:13:14+00:00Added an answer on May 31, 2026 at 9:13 am

    Pass all arguments in NSDictionary

    NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:
        @"Object1", @"key1", @"Object2", @"key2", nil];  
    
    //performSelector:withObject:dict afterDelay
     //  [self performSelector:@selector(aSelector) withObject:dict afterDelay:(NSTimeInterval)delay ];
    
    -(void)aSelector : (NSDictionary *)dict
    {
        id lFirstArg = [dict objectForKey:@"Key1"]
        ...
    }
    

    If you dont want to change your method Signature, use NSInvocation. Take a look at this SEL performSelector and arguments post.

    -(void)myMethodWith:(int)number andBOOL:(BOOL) someBool andStr:(NSString *)str{
        NSLog(@"%d %d %@",number,someBool,str);
    }
    
    -(void) testMethod{
        SEL sel = @selector(myMethodWith:andBOOL:andStr:);
        int i = 10;
        BOOL bol = YES;
        NSString *str = @"Hello !";
        NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:sel]];
        [inv setSelector:sel];
        [inv setTarget:self];
        [inv setArgument:&i atIndex:2]; //arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation
        [inv setArgument:&bol atIndex:3];
        [inv setArgument:&str atIndex:4];
        [inv performSelector:@selector(invoke) withObject:nil afterDelay:30];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently making an iphone web app based on Google App Engine (python). I
currently im making some crawler script, one of problem is sometimes if i open
I am currently building an making my new website. It uses one page and
currently making a SOAP request using Java's SOAPConnectionFactory and SOAPConnection 's .call() method, which
I am currently making a context menu which open from left button click instead
Currently I am making some decisions for my first objective-c API. Nothing big, just
I'm currently having some linker problems when trying to compile an Objective-C program and
I am currently making a module, which does the hard work for you with
I'm currently making a Drag-and-Drop javascript engine. I want to make one class (
i'm currently making search engine for a website content (only for searching within that

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.