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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:27:40+00:00 2026-05-24T07:27:40+00:00

I’ve asked how I can make a custom view repeat itself into several separate

  • 0

I’ve asked how I can make a custom view repeat itself into several separate copies and have been told that I should use NSNib or NSViewController. I have a custom view in an nib file, whenever a user clicks a button, I want a new copy of the nib view to appear, while still maintaining the previous one somewhere else on the screen for up to ten separate views running simultaneously. Since each of these takes some user input before appearing, I assume they must each be separate objects or something to make them be distinct and to not interfere with one another.

I can make the first one of the views appear using

NSNib *nib = [[NSNib alloc] initWithNibNamed:@"IndividualTimers" bundle:nil];

[nib instantiateNibWithOwner:self topLevelObjects:nil];

But that just makes the same view restart every time the button is pressed, I can tell that both views have been combined into that view because a timer that appears on it starts ticking twice as fast, but they should be independently seen in two different instances of the view.

Someone told me I should use set a different file’s owner.

So far people have been helpful but not very specific. I don’t know what File’s Owner I should set, how to programmatically create a new object to hold each instance of the loaded nib (if that’s even how it’s done) or if I need an individual object for each load.

Basically, I want to know how to take one nib file, and use it as a template to be loaded up to ten separate times, while each of the (up to) ten views is running simultaneously, but independently.

I’d really appreciate any specific help you could give since this is the single biggest problem I’ve encountered while programming in Xcode. I’ve been stuck for weeks.
Thanks for all the help.

  • 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-24T07:27:41+00:00Added an answer on May 24, 2026 at 7:27 am

    When you instantiate a nib file, it assigns the unarchived objects to properties of its File’s Owner.

    If you connect an IBOutlet UIView property to the root view in your nib, then when the nib is instantiated the newly created object will be assigned to that property.

    In order to create a new object each time the nib is instantiated, you need to copy the value of the IBOutlet property elsewhere since it will be overwritten the next time the nib is instantiated.


    For instance, assuming that you have connected a timerViewFromNib property to an NSView in your nib file:

    @property (nonatomic, assign) IBOutlet NSView *timerViewFromNib;
    @property (nonatomic, assign) NSView *timerView1;
    @property (nonatomic, assign) NSView *timerView2;
    

    You can add obtain and display two distinct instances of that view as follows:

    NSNib *nib = [[NSNib alloc] initWithNibNamed:@"IndividualTimers" bundle:nil];
    
    [nib instantiateNibWithOwner:self topLevelObjects:nil];
    self.timerView1 = self.timerViewFromNib;
    self.timerView1.frame = CGRectMake(...);
    [self.view addSubview:self.timerView1];
    
    [nib instantiateNibWithOwner:self topLevelObjects:nil];
    self.timerView2 = self.timerViewFromNib;
    self.timerView2.frame = CGRectMake(...);
    [self.view addSubview:self.timerView2];
    
    self.timerViewFromNib = nil;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I have just tried to save a simple *.rtf file with some websites and
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from

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.