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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:46:41+00:00 2026-06-06T01:46:41+00:00

I have a noob-question, that might be similar to Dynamically create multiple instances of

  • 0

I have a noob-question, that might be similar to Dynamically create multiple instances of a UIView from a NIB but I’m missing the big picture.

I’ve got a class with NIB, called UserViewController and I need to create multiple instances, based on the number of users, store them in an array and be able to modally navigate between them.

A class with NIB, called SelectNumberOfUsersViewController contains this IBACTION-code:

users = [[NSMutableArray alloc] init];
for (int i=0; i<numberOfUsers; i++) {
    user = [[UserViewController alloc] init];
    user.userid = i+1;
    [user doInitialization];
    [users addObject:user];
} 

I see that the initWithNibName of the instance user is run, but how do I address and show the UI for the first user in the users array?
I’m not sure if commands like

myView = [[[NSBundle mainBundle] loadNibNamed:@"XXX" owner:self options:nil] objectAtIndex:0];
[[self view] addSubview:searchDateView] 

should be used, since the array contains entire objects of the class User with NIB and everything – or…?

  • 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-06T01:46:42+00:00Added an answer on June 6, 2026 at 1:46 am

    If you want to initialise a viewcontroller with a nib file you should use:

    user = [[UserViewController alloc] initWithNibName:@"NibName" bundle:nil];
    

    If you want to push that view you could call:

    [self.navigationController pushViewController:user animated:true];
    

    To present it, call:

    [self presentModalViewController:user animated:true];
    

    If you just want to add the view to the current viewcontroller use:

    [self.view addSubView:user.view];
    

    But the sure to remove the previous one too.

    I hope this was of any help.

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

Sidebar

Related Questions

I'm a bit of a javascript noob, but I have a general question that
This might be a noob question, but can't find an answer anywhere. I have
Maybe that's a noob question but is there a way to have an yellow
This is kinda a noob question. I have a controller that update record from
Noob question here! I have an array with hashes that looks like this: arr
Noob question. I have an activate handler in a child List , but it
Bit of a noob question but: I have a custom class defined as: public
This is a question from a Java noob. I have eclipse open (JRE 1.6),
This is probably a noob question that I will get slated for but here
PowerShell noob question here. I have groups of servers that are listed in separate

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.