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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:01:46+00:00 2026-05-15T01:01:46+00:00

Is it possible to use the class methods of some NSObject I’ve made to

  • 0

Is it possible to use the class methods of some NSObject I’ve made to controls all existing instances?

I want a delegate class to be able to send messages to the Object’s class methods which can then react appropriately with everything out there.

  • 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-15T01:01:46+00:00Added an answer on May 15, 2026 at 1:01 am

    Not without using some collection of the objects. The simplest way to do it would be to store the objects in an array and send them all a message when you want something to happen. Specifically:

    static NSMutableArray *allObjects = nil;
    + (void) initialize {
        if (!allObjects) {
            allObjects = [NSMutableArray new];
        }
    }
    - (id) init {
        if (self = [super init]) {
            //Each object gets held in an array
            [allObjects addObject:self];
        }
        return self;
    }
    + (void) doSomethingToEveryObject {
        [allObjects makeObjectsPerformSelector:@selector(doSomethingToThisObject)];
    }
    - (void) doSomethingToThisObject {
        NSLog(@"Did something to %@",self];
    }
    - (void) release {
        [super release];
        //When the retain count reaches 1, then all external references have disappeared,
        //and the only remaining reference is in the objects array.
        if (self.retainCount == 1) {
          [allObjects removeObject:self];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all: I want to use Java EE not Spring! I have some
I have a utility class with some static methods which I use in some
Would anyone be able to advise if it’s possible to re-use an existing HtmlHelper
is it possible to use a method of an abstract class? how can i
Is it possible for me to use ChangeHappend in my derived class. If so
Is it possible to forward-declare a nested class, then use it as the type
Is it possible to change PowerPacks.LineShape smoothingMode? I tried to use this code(a class
I'm trying to use the methods of class as the django-celery tasks, marking it
I have a utility class that stores methods that are useful for some unit
Possible Duplicates: What's the use of const here Using 'const' in class's functions Hi

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.