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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:40:28+00:00 2026-05-26T23:40:28+00:00

I am trying to use custom UITableViewCells defined in IB where there are referencing

  • 0

I am trying to use custom UITableViewCells defined in IB where there are referencing outlets. I have successfully used the techniques shown in several places in stackoverflow to load and use UITableViewClass when there is no referencing outlet, like below.

NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"TheCellsClass" owner:nil options:nil];

I have a separate file called “TheCellsClass.xib”, which has a single UITableViewCell defined with a single UILable called Alabel, “IBOutlet UILabel *Alabel;”. If I connect the label to ALabel then I get this error

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSObject 0x681b360> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Alabel.'

After searching here and the web I understand that this is caused by the fact that “owner:nil” does not define a class with this object:Alabel. I cannot use “owner:self” because that is the UITableViewController, and also does not define “Alabel”.

I created a class called “TheCellsClass” as a sub class of “UITableViewCell” that does define Alabel, see below;

Then used:

        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"TheCellsClass" owner:cell options:nil];

I still get the same error. So, can anyone point out the error of my ways? 🙂
I only way I can think to fix this is to remove all referencing outlets and connect
them using code

Subclass header :

#import <UIKit/UIKit.h>
@interface TheCellsClass : UITableViewCell {   
    IBOutlet UILabel *Alabel;    
}
@property (strong, nonatomic) UILabel *Alabel;
@end

Subclass body:

#import "TheCellsClass.h"
@implementation TheCellsClass
@synthesize Alabel;
@end

In the table view controller

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

I am using:

TheCellsClass* cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {
    if (cell == nil) {
        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"TheCellsClass" owner:cell options:nil];

A zip of a sample project is here http://www.proaa.com/tryout.zip

Suggestions? Requests for more info?

Any help appreciated.
Geoff

  • 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-26T23:40:28+00:00Added an answer on May 26, 2026 at 11:40 pm

    Three things:

    1. Remove TheCellClass from DetailViewController.xib

    2. ALabel is linked to File’s Owner in TheCellsClass – link it instead to TheCellsClass in the Objects section. Also consider renaming ALabel – it is standard to name instance variables beginning with a lowercase letter.

    3. In MasterViewController, change

      NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"TheCellsClass" owner:cell options:nil];
      

    to

        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"TheCellsClass" owner:nil options:nil];
    

    After these three changes, your custom TableViewCell appeared in the simulator. Also consider renaming TheCellsClass to something that hints at what it’s subclassing, like MyCustomTableViewCell.

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

Sidebar

Related Questions

When trying to use a custom JSP tag library, I have a variable defined
I'm trying to use a custom assembly in Report Builder 2.0. I have added
I am trying to use custom font in android. I have written java code
I have a class mapped with NHibernate and I'm trying to use a custom
I'm trying to use a custom UITableViewCell, and I've placed it in the same
I'm trying to use custom container widgets in gtk.Builder definition files. As far as
I'm trying to use a custom configuration section, something I've done numerous times before
I'm trying to use a custom validator with jQuery Validation plugin. However, I'm unsure
I'm trying to use multiple attributes in my custom tag, e.g.: <mytaglib:mytag firstname=Thadeus lastname=Jones
I'm trying to use pyqt to show a custom QDialog window when a button

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.