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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:03:44+00:00 2026-05-25T11:03:44+00:00

I have a table view which loads another xib file and uses the content

  • 0

I have a table view which loads another xib file and uses the content of that new xib file to display the header. In this new xib I have a UIImageView and a label. I want to be able to change the image and the label from view did load. I have linked up everything in interface builder properly. It just won’t change the image or the text label.

Header file

////h file///
#import <UIKit/UIKit.h>
#import "MyProfile.h"

@interface MainMenu : UITableViewController
{
    IBOutlet UIView *headerView;
    UIImageView *imageview;
    UILabel *label;
}

@property (nonatomic, retain) IBOutlet UIImageView *imageview;
@property (nonatomic, retain) IBOutlet UILabel *label;

-(UIView *)headerView;
-(IBAction)fn:(id)sender;

@end

Partial .m file

///// partial .m file////
-(UIView *)headerView
{
    if(!headerView)
    {
        [[NSBundle mainBundle] loadNibNamed:@"HeaderView" owner:self options:nil];
    }

    return headerView;
}

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

-(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return [[self headerView] bounds].size.height;
}

-(id) init
{
    self = [super initWithStyle:UITableViewStyleGrouped];

    return self;
}

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

- (void)viewDidLoad
{
    [super viewDidLoad];
    [[self navigationItem] setTitle:@"The Table"];

    menuitems = [[NSMutableArray alloc] init];

    [menuitems addObject:@"item one"];
    [menuitems addObject:@"item two"];

    fieldnames = [[NSMutableArray alloc] init];

    [fieldnames addObject:@"Date of Birth"];
    [fieldnames addObject:@"Nationality"];

    label.text = @"new label value will not be displayed!";
}

Why won’t the text label update?

I have set the header view’s xib file’s owner to be the main menu and I have connected the label in header view.xib up to the IBOutlet.

Thanks.

  • 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-25T11:03:45+00:00Added an answer on May 25, 2026 at 11:03 am

    Ok I solved it. I don’t know If this is the way that you are supposed to do it but it works.

    If you stick

        label.text = @"new label value will not be displayed!";
    

    in

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

    and then reload the xib inside viewdidload:

        [[NSBundle mainBundle] loadNibNamed:@"HeaderView" owner:self options:nil];
    

    it works. Is this the way you are supposed to do it?

    Thanks

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

Sidebar

Related Questions

I have an array which loads in table view, and if users taps a
I have a simple table view which is editable. All I need the user
I have a table view controller which doesn't let me manually scroll to the
I have a view table which is a union of two separate tables (say
When I have a table view with some sections which have their own headers
I have a navigation controller which also has a table view. I want to
I have a UISearchBar which is subviewed by another view when a button is
I have a Yii dropdown which loads a table of cities, states, zipcodes, lat
In my app I have a UITableViewCobtroller which creates the table view with checkmark
I have a view which I built in Interface builder with a tableview and

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.