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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:45:10+00:00 2026-06-02T22:45:10+00:00

Am trying to get a UITableView to display a headerView.xib which I have created,

  • 0

Am trying to get a UITableView to display a headerView.xib which I have created, but after building it, nothing shows. Want to make the UITableView editable, and have added three methods to the ItemsViewController.m file, but nothing shows.

What’s wrong? Thanks in advance.

Here are the relevant files:

ItemsViewController.h

#import <Foundation/Foundation.h>

@interface ItemsViewController : UITableViewController
{
  IBOutlet UIView *headerView;
}

-(UIView *)headerView;
-(IBAction)addNewItem:(id)sender;
-(IBAction)toggleEditingMode:(id)sender;

@end

ItemsViewController.m

#import "ItemsViewController.h"
#import "BNRItemStore.h"
#import "BNRItem.h"

@implementation ItemsViewController // Incomplete implementation

-(id)init
{
  // Call the superclass's designated initializer
  self = [super initWithStyle:UITableViewStyleGrouped];
  if (self) {
    for(int i = 0; i < 5; i++) {
      [[BNRItemStore sharedStore]createItem];
    }

  }
  return self;
}

-(id)initWithStyle:(UITableViewStyle)style
{
  return [self init];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
  return [[[BNRItemStore sharedStore]allItems]count];
}

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


  // Check for a reusable cell first, use that if it exists
  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"];

  // If there is no reusable cell of this type, create a new one
  if (!cell) {
    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"UITableViewCell"];
  } 

  // Set the text on the cell with the description of the item
  // that is at the nth index of items, where n = row this cell
  // will appear in on the tableview
  BNRItem *p = [[[BNRItemStore sharedStore]allItems]objectAtIndex:[indexPath row]];

  [[cell textLabel]setText:[p description]];

  return cell;
}

-(UIView *)headerView
{
  // If we haven't loaded the headerView yet
  if (!headerView) {
    //Load HeaderView.xib
    [[NSBundle mainBundle]loadNibNamed:@"HeaderView" owner:self options:nil];
  }
  return headerView;
}

-(UIView *)tableView:(UITableView *)tv viewForHeaderInSection:(NSInteger)sec
{
  return [self headerView];
}

-(CGFloat)tableView:(UITableView *)tv heightForHeaderInSection:(NSInteger)sec
{
  // The height of the header view should be determined from the height of the 
  // view in the XIB file
  return [[self headerView]bounds].size.height;
}



@end
  • 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-02T22:45:13+00:00Added an answer on June 2, 2026 at 10:45 pm

    One or both of the following things is not set up correctly. First, the File’s Owner object in HeaderView.xib needs to have its class set to ItemsViewController. After that, the headerView outlet needs to be connected from File’s Owner to the top-level view in the xib.

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

Sidebar

Related Questions

I have a grouped UITableView in my code and am trying to get the
I'm trying to get my UITableView to show cells with images placed on them
Trying to get an ASP application deployed; it worked for a while but then
I am trying to get the sections and index for UITableView from Sqlite (I
I have an interesting problem. I am loading a UITableView asynchronously. I am trying
here's my issue, i'm trying to create a UITableView that is able to display
I have a UITableView which displays images. Every cell has an image and every
I'm trying to get hold of data from a NSXMLParser I have the following
I have spent the last several hours trying to get this to work and
I have a tableviewcontroller with data population it. I'm trying to get a new

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.