65081

Invalid nib registered for identifier

I'm trying to get a view created in a nib file to be used as a section header in my UITableView. I'm following the 3rd option as described here

http://hons82.blogspot.it/2014/05/uitableviewheader-done-right.html

But I'm getting this error

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'invalid nib registered for identifier (sectionHeaderIndentifier) - nib must contain exactly one top level object which must be a UITableViewHeaderFooterView instance'

Here's the code I'm using

UINib *sectionHeaderNib = [UINib nibWithNibName:@"headerNib" bundle:nil]; NSString *SectionHeaderViewIdentifier = @"sectionHeaderIndentifier"; [self.tableView registerNib:sectionHeaderNib forHeaderFooterViewReuseIdentifier:SectionHeaderViewIdentifier];

and

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { NSString *SectionHeaderViewIdentifier = @"sectionHeaderIndentifier"; HeaderSection *sectionHeaderView = [self.tableView dequeueReusableHeaderFooterViewWithIdentifier:SectionHeaderViewIdentifier]; return sectionHeaderView; }

And here's a screen shot of my nib file.

<img src="https://i.stack.imgur.com/ugQ4p.png" alt="enter image description here">

Answer1:

The message says the root view (not file's owner) must be specifically an instance of UITableViewHeaderFooterView.

Recommend

  • how do you “Press ENTER to continue, anything else to quit” in C++
  • Can't add target for UIButton - unrecognised selector sent to instance, despite method been in
  • Why does this code crash on the distributed app but work in the debugger?
  • C++, user input check for '\\0' stops at spaces?
  • K Shortest Path Python Not Working
  • KoGrid JSON Dynamic widgets, with nested server calls
  • Cleave.js Phone CA
  • jQuery file download plugin
  • Understanding Intl.DateTimeFormat as a JavaScript object
  • Why does Apple use assign rather than weak to store a delegate?
  • Does Context/Scoping of a SQLAlchemy Session Require Non-Automatic Object/Attribute Expiration?
  • Android application not restoring state when installed from .apk, works fine from eclipse
  • unrecognized selector isPitched called
  • Does the MySQL IN clause execute the subquery multiple times?
  • ConfigurationBuilder not working in azure function
  • Losing my session variables
  • IE6 changes DOCTYPE to a bad one
  • Better Indy for Dephi 2007
  • JavaScript IE rotation transform maths
  • C# - Most efficient way to iterate through multiple arrays/list
  • Cannot save model when using ember render helper
  • VBA Excel, loop through variables
  • Consuming a WCF service in a Java Client using wsHttpBinding
  • Clear fused location provider's location for testing
  • Trying to get the char code of ENTER key
  • Using Sax parsing to edit and write XML in VB6
  • Debug.DrawLine not showing in the GameView
  • Yii2: Config params vs. const/define
  • Is calc() supported in html email?
  • req.body is undefined - nodejs
  • How to convert from System.Drawing.Color to Excel.ColorFormat in C#? Change comment color
  • javascript inside java/jsp code
  • Symfony2: How to get request parameter
  • Akka Routing: Reply's send to router ends up as dead letters
  • Is there a mandatory requirement to switch app.yaml?
  • SetUp method failed while running tests from teamcity
  • Android Studio and gradle
  • What are the advantages and disadvantages of reading an entire file into a single String as opposed
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • How can i traverse a binary tree from right to left in java?