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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:40:54+00:00 2026-06-10T15:40:54+00:00

I have an interface that allows users to select a type of childObject. These

  • 0

I have an interface that allows users to select a type of childObject. These objects all inherit from the same parentObject. Is there a way to dynamically generate this list of childObjects given a parentObject? Currently, when I create a new child, I then have to add it to the TVC’s list of children to display.

Edit:
Here’s an example:

Class A (child of NSObject)
->Class A1 (child of Class A)
->Class A2 (child of Class A)

I’d like to ask Class A: “What are your children?”

  • 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-10T15:40:56+00:00Added an answer on June 10, 2026 at 3:40 pm

    You can use reflection:

    // find out the superclass of a class or object
    Class parent = [[theObject class] superclass];
    
    // get all classes loaded
    unsigned n_classes = objc_getClassList(NULL, 0);
    Class *classes;
    classes = malloc(sizeof(*classes) * n_classes);
    objc_getClassList(classes, n_classes);
    
    // Filter the classes so that only child classes of the
    // particular parent class are present
    NSMutableArray *children = [NSMutableArray array];
    int i;
    for (i = 0; i < n_classes; i++) {
        if ([classes[i] isKindOfClass:parent]) {
            [children addObject:classes[i]]; // Yes, classes temselves are objects
        }
    }
    
    free(classes);
    

    Here ‘children’ will contain the descandants of parent.

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

Sidebar

Related Questions

I have a website that allows users from around the world to submit profiles.
I have an universal app that allows to select an image from the device
I have a SQL interface page in my classic ASP web app that allows
I have an interface that has a generic method with two type parameters. I
I have an IRepository interface that inherits from IRepository<TObject> . I also have a
I have a Silveright app that allows users to specify filters on a few
I have written an application (using Delphi 2009) that allows a user to select
I have an Android PreferencesAcitivty that allows users to reset their Preferences to their
I have created an application that allows users to capture information for entities based
I'm trying to build an application that allows users to drag files from Finder

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.