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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:12:48+00:00 2026-06-03T23:12:48+00:00

Here’s my setup. I subclassed UIViewController once to create a single Widget view controller

  • 0

Here’s my setup. I subclassed UIViewController once to create a single “Widget” view controller that handles everything that all of my widgets can do. I then subclassed the Widget View Controller for each of my widgets, since they each handle their own unique and often complex set of functions.

I want to create an array of Widgets that stores each active widget in my scene, however I’m having trouble trying to figure out how to initialize the proper widget to store in the array. Initially I figured I could just do [widgets addObject:[[Widget alloc] initWithNibName:widgetName bundle:nil]];, however that completely ignores the individual widget initWithNibName function and goes right to the abstracted Widget class (which makes sense, since that’s the class that I’m loading it into…).

How can I get my classes loaded into this array properly with each widget being initialized by its own unique subclass? Feel free to recommend structural changes as well, if necessary.

  • 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-03T23:12:49+00:00Added an answer on June 3, 2026 at 11:12 pm

    If the name of the class is the same as the nib

    NSArray* widgets = [NSArray arrayWithObjects: @"MyVC1",@"MyVC2",nil];
    
    NSString* newVC = [widgets objectAtIndex: value];
    
    Class classVC = NSClassFromString(newVC);
    
    Widget* controller = [[classVC alloc] initWithNibName:newVC bundle:nil];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the setup - I have a view that lists products. On that same
Here is my problem : I have a post controller with the action create.
Here is my code (Say we have a single button on the page that
I'm trying to create an if statement in PHP that prevents a single post
Here is the problem that I am trying to solve. I have two folders
Here is my program to find all the subsets of given set. To solve
Here's the basic setup: I have a thin bar at the top of a
Here's my procedure: DROP PROCEDURE IF EXISTS `couponExpires`$$ CREATE DEFINER=`root`@`localhost` PROCEDURE `couponExpires`(IN couponID BIGINT,
Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here's what I'm trying to accomplish with this program: a recursive method that checks

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.