ios - Connecting IBOutlet results in nsunknownkey exception -


I know that as soon as you read the title, you should think .. well good but I believe that I'm banging my head with this for the last 2 days. I have tried every solution mentioned in the stack overflow and anywhere else I can get on the internet but nothing works. I tried to start my project again (fortunately, I got stuck in a very early stage) but it still throws the same exception.

Here is a description of my problem. I have created a custom cell as a subclass of UITableViewCell (now a very common eh) Now my view controller (which has a UITWV added) registers for my customsell in Wikipedia is.

And on cellForRowAtIndexPath, I just do a dequeueReusableCellWithIdentifier. So far, so good. I set this project on fire and everything is going well. I can load my custom cell in the tableview.

The problem starts when I connect any control to an IBotlet from my custom cell. This rebuffs *** Android app 'NSUnknownKeyException' due to the exceptions of the exceptions, reason: '[& lt; NSObject 0xa4b4fe0 & gt; SetValue: forUndefinedKey:]: The key value for this class key vidName is not coding-pro. '

Now I have tried all of these:

  • Changing the file owner of XIB to my custom cell class, NSObject has my view On the controller, but no luck.

  • Changing the name of my outlet (if naming conflict may occur), but still the same result.

  • Change the "main interface" for different view controllers and nothing except this blank.

  • I have also tried to remove every single control by leaving a label in my cell.

FYI .. My project is a universal project and I am using Xcode 5.

Update: cellForRowAtIndexPath code

  NSString * CellIdentifier = @ "CustomCellReuseID"; VideoCustomCell * cell = [Tableview DeWewer Re-Eligible CellWithIdentifier: Cell Identifier for IndexPath: IndexPath]; Cell.vidName.text = [NSString stringWithFormat: @ "% d", indexPath.row]; Return cell;  

Whatever I have collected so far, it seems that you have the following setup

  • A storyboard with a UITableViewController and related table view controller class
  • An Xib for custom cell and you use registerNib based on the register view
  • A custom cell class that you use to set vidName label text dynamically.

Am I missing anything?

When you create an Xib file for the table view cell, you set the cell instance in the custom cell class in the interface builder - not the owner of the file. Then, you connect the label outlet in the interface builder in your cell instance. Such as:

Enter image details here

Now your rest Code should work:

  - (zero) viewDidoadload {[Super Viewedload]; [Serial View Register NIB: [UINIB NIBYTHNIBN: @ "Video Custom Cell" Bundle: CellRuientifier for: [NSBindal Main Bundle]]: "Custom" CLURUIDID "]; } #pragma mark - UITableView Rep / Data Source - (NSInteger) TableView: (UITableView *) table view numberofrease insaction: (NSInteger) section {return 10; } - (UITableViewCell *) TableView: (UITableView *) TV cellForRowAtIndexPath: (NSIndexPath *) Index pathway {NSString * CellIdentifier = @ "CustomCellReuseID"; VideoCustomCell * cell = [self.tableView dequeueReusableCellWithIdentifier: CellEindified for IndexPath: IndexPath]; Cell.vidName.text = [NSString stringWithFormat: @ "% d", indexPath.row]; Return cell; }  

I have posted a sample project here that can help further:


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -