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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:18:41+00:00 2026-06-15T23:18:41+00:00

I have a general routine, which takes a few parameters. Something like: -(id) doStuff:(int)A:(int)B:(int)C

  • 0

I have a general routine, which takes a few parameters.
Something like:

-(id) doStuff:(int)A:(int)B:(int)C {
    //doStuff
    return object;
}

I have a UITableViewController, which houses a number of custom cells, each with their own ID. When ‘Save’ is hit, these cells are iterated and some cells need ‘additional behaviour’ when they are being saved.

Up to now, I’ve created a ‘Callback’ object, which stores an NSString * and a delegate in the custom cell. Upon being ‘Saved’, the cell looks, whether it has any callbacks to apply and uses

SEL sel = NSSelectorFromString(Sel);
if([Del respondsToSelector:sel])
    [Del performSelector:sel withObject:Cell];

Now that works somewhat well…, however, it requires the method I pass to do a switch/case on the ID of the Cell that’s passed, and I’d like to avoid that.

That’s why I’d like to use blocks instead, but I don’t really know how to store a parameterized block in a variable.

What I’m trying to do:

Declare a function block doStuff.

id (^doStuff) (int, int, int) = ^(int A, int B, int C) {
    //does Stuff
};

And add the previously created block as callback

[Cell addCallback:(^doStuff)(1, 2, 3)];

The block must NOT be called at that moment, but stored in the cell and only called it when the time is right.
How would I go about this correctly?

Thank you very much.

Edit: What I’d also like to avoid is storing the parameters for the block in the cell and pass them upon calling, because that would require me to further specialize the cells unnecessarily.

  • 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-15T23:18:43+00:00Added an answer on June 15, 2026 at 11:18 pm

    It sounds like what you want is a block that calls your block, something like this:

    [cell addCallback:^{ doStuff(1, 2, 3); }];
    

    But this is a rather odd and convoluted design. It seems like there is probably a way to write it with only one block, but it’s hard to give a solution that specific without a better idea of what you’re doing.

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

Sidebar

Related Questions

i have a general question : i'd like to develop a facebook application using
Probably a dumb question, but does MSIL have general Forth-like functions for manipulating data
I have a general question on the class definition and its use..THe below code
I have a general purpose Utility dll file used in my WPF program. The
I have a general question about interpreters of functional languages: Are there actually any
I have a general question about the new Django 1.3 static file framework. I
I have a general OOP question. If I have the following classes in C#
I have a general question that is rather open-ended (i.e. depends on platform, application
I have a general question for the group. I am about to start a
I have a general Java method with the following method signature: private static ResultSet

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.