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

  • Home
  • SEARCH
  • 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 6749259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:40:08+00:00 2026-05-26T12:40:08+00:00

How do you pass one method as a parameter to another method? I’m doing

  • 0

How do you pass one method as a parameter to another method? I’m doing this across classes.

Class A:

+ (void)theBigFunction:(?)func{
    // run the func here
}

Class B:

- (void)littleBFunction {
    NSLog(@"classB little function");
}

// somewhere else in the class
[ClassA theBigFunction:littleBFunction]

Class C:

- (void)littleCFunction {
    NSLog(@"classC little function");
}

// somewhere else in the class
[ClassA theBigFunction:littleCFunction]
  • 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-26T12:40:09+00:00Added an answer on May 26, 2026 at 12:40 pm

    The type you are looking for is selector (SEL) and you get a method’s selector like this:

    SEL littleSelector = @selector(littleMethod);
    

    If the method takes parameters, you just put : where they go, like this:

    SEL littleSelector = @selector(littleMethodWithSomething:andSomethingElse:);
    

    Also, methods are not really functions, they are used to send messages to specific class (when starting with +) or specific instance of it (when starting with -). Functions are C-type that doesn’t really have a “target” like methods do.

    Once you get a selector, you call that method on your target (be it class or instance) like this:

    [target performSelector:someSelector];
    

    A good example of this is UIControl‘s addTarget:action:forControlEvents: method you usually use when creating UIButton or some other control objects programmatically.

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

Sidebar

Related Questions

I need to pass a parameter from one method in a controller to another.
I'm trying to pass one method to another in elisp, and then have that
To pass parameters from one activity to another is used the method intent.putExtra() Does
If I want to pass a structure defined in windows.h to one of method
Simple task like make AJAX request , pass one parameter and return result, can
If all that you're doing is a simple one-pass iteration (i.e. only hasNext() and
I have this method: public static Expression<Func<MyEntity, bool>> MyMethod(string someId) { return o =>
This is a simplified version of the code in question, one generic class uses
I have a class that creates an object inside one public method. The object
I have a rather silly question, I need to pass a parameter from one

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.