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...?