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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:08:52+00:00 2026-06-10T09:08:52+00:00

I need to create several similar views In a easy way,I create some views

  • 0

I need to create several similar views
In a easy way,I create some views in xib(each full screen)

And I have a view controller to use this xib’s views,code like this:

NSArray* views = [[NSBundle mainBundle] loadNibNamed:@"MyXibName" owner:nil options:nil];
[self.view addSubview:[views objectAtIndex:aIndex]];

At this moment,view shows alright.

Now,there’s some buttons in those views,so I connect a outlet for each view

bad thing happened

app crashed due to

uncaught exception ‘NSUnknownKeyException’, reason: ‘[<NSObject 0x969db50> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key

Analyse:
Although my xib file’s “File Owner” has been set,but there’s no connection between xib and the only view controller.

How could I get the pointer of a view’s button?

  • 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-10T09:08:53+00:00Added an answer on June 10, 2026 at 9:08 am

    You can do it like this:

    NSNib*      aNib = [[NSNib alloc] initWithNibNamed:@"MyGreatNib" bundle:nil];
    NSArray*    topLevelObjs = nil;
    
    for (SomeClass *obj in myOwnerObjects) {
        topLevelObjs = nil;
    
        if (![aNib instantiateNibWithOwner:obj topLevelObjects:&topLevelObjs])
        {
            NSLog(@"Warning! Could not load nib file.\n");
            return;
        }
    
        for (id topLevelObj in topLevelObjs) {
            if ([topLevelObj isKindOfClass:[NSView class]]) {
                NSView *otView = (NSView *)topLevelObj;
                // set frame...
                [self addSubview:otView];
            }
        }
    }   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We need to create several SQL reports, each of which depends upon the results
I have dynamically created WrapPanel (_wp) with several Borders. And I need create handler
I need to create several Divs dynamically, and I need to add onmouseover event
I need to create several counters for a system health check and monitoring. Since
I need to create several Raphael objects in my program. field1 and field2 are
I need to create and combine several expressions for child entity into one to
For my Ruby on Rails application, I need the possibility to create several LectureNote
I need to create a single trace file that spans several days for one
I have created login page forced login in several pages. Now i need to
Often I want to have a main repository of source, shared by several similar

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.