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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:21:38+00:00 2026-05-16T20:21:38+00:00

I would like for my section header to display the sum of the values

  • 0

I would like for my section header to display the sum of the values in my rows.
I therefore implement the:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

delegate function and place a UILabel in the custom view I build here.

If this were a UITableViewCell I would build the cell if it did not exist, then update it, or if it exists – only update it.

I don’t know which “pattern” to use to update my Section Header.
Either there is a “right way” build into the UITableView, but I can’t seem to find an “updateSectionHeaderForSection” and call this only when I change the value of a row.

What puzzles me is how the UITableView deals with headers, does it call viewForHeadersInSection only once on reloadData/instantiation or does it call it all the time, i.e. does it instantiate the view repeatedly when scrolling if I place this code in the viewController?:

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {

        UIImageView *shadow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"topbar.png"]];

}

And how do I force the section header to update the view, like calling updateRowsAtIndexPaths, when I have changed the value it should display?

I can’t seem to find Apples take on this in the UITableView Programming Guide.

Thanks in advance for any help given.

  • 1 1 Answer
  • 7 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-16T20:21:38+00:00Added an answer on May 16, 2026 at 8:21 pm

    I had to do a similar thing recently, the way I did it was to draw a custom view in viewForHeaderInSection. This view contained a number of different components and for the label that I wanted to show the total in I gave it a tag

    detailLabel.tag=100001;
    

    Then, whenever I wanted to update the total I retrieve the associated view

    UILabel *total = (UILabel*)[self.view viewWithTag:100001];
    

    And update it to the value I wanted:

    total.text = @"1234";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIView in a table view section header that I would like
I have a UISearchDisplayController in the Header section of my UITableView. I would like
Take the Winlogon registry section, I would like PowerShell to display the Data value
I would like to present a UITableView with a basic layout like this: header
I would like to add a comments section to our postings. Our websites are
I would like to link to a specific section of a report from another
I would like to collect all the <script> ....</script> code section present in the
On my page I have a section where I would like to pull in
I would like to make a big display by putting monitors side by side.
I have added a UIButton in the header section of the UITableView via the

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.