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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:24:39+00:00 2026-05-14T22:24:39+00:00

I have an optimization problem for the headers of a table with plain style.

  • 0

I have an optimization problem for the headers of a table with plain style. If I use the standard view for the table (the classic gray with titles set by titleForHeaderInSection:) everything is ok and the scrolling is smooth and immediate.

When, instead, use this code to set my personal view:

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

    return [self headerPerTitolo:[titoliSezioni objectAtIndex:section]];
}

- (UIImageView *)headerPerTitolo:(NSString *)titolo {

    UIImageView *headerView = [[[UIImageView alloc] initWithFrame:CGRectMake(10.0, 0.0, 320.0, 44.0)] autorelease];
    headerView.image = [UIImage imageNamed:kNomeImmagineHeader];
    headerView.alpha = kAlphaSezioniTablePlain;

    UILabel * headerLabel = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease];
    headerLabel.backgroundColor = [UIColor clearColor];
    headerLabel.opaque = NO;
    headerLabel.textColor = [UIColor whiteColor];
    headerLabel.font = [UIFont boldSystemFontOfSize:16];
    headerLabel.frame = CGRectMake(10.0,-11.0, 320.0, 44.0);
    headerLabel.textAlignment = UITextAlignmentLeft;
    headerLabel.text = titolo;

    [headerView addSubview:headerLabel];

    return headerView;
}

scrolling is jerky and not immediate (sliding the finger on the screen does not match an immediate shift of the table).

I do not know what caused this problem, maybe the fact that every time the method viewForHeaderInSection: is called, the code runs to create a new UIImageView.

I tried many ways to solve the problem, such as creating an array of all the necessary view: apart from more time spent loading at startup, there is a continuing problem of low reactivity of the table.

‘ve Attempted by reducing the size of UIImageView positioned from about 66 KB to 4 KB: not only has a deterioration in quality of colors (which distorts a bit ‘original graphics), but … the problem persists!

Perhaps you have suggestions about it, or know me obscure techniques that enable me to optimize this aspect of my application …

I apologize for my English, I used Google for translation.

  • 1 1 Answer
  • 6 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-14T22:24:40+00:00Added an answer on May 14, 2026 at 10:24 pm

    The main cause of slowdown is that you are allocating new views each time the header view is requested.

    Since you know what the header views will look like, and you know how many there are, you may want to pre-create all of the header views, store them in an array, and return them as requested.

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

Sidebar

Related Questions

I have to solve the following optimization problem: Given a set of elements (E1,E2,E3,E4,E5,E6)
I have a complex objective function I am looking to optimize. The optimization problem
I wrote a program which solves some kind of optimization problem. I have been
I have a strange problem after turning on level 1 optimization in gcc. What
I have an optimization problem as follows. Given an array of positive integers, e.g.
I welcome any help for the following code optimization problem: I have a collection
Hi algorithm fans! I have problem to solve which is classified as combinational optimization
I have tried to use restrict qualified pointers, and I have encountered a problem.
I have an optimization problem I want to solve. You have some kind of
I have an optimization problem that the Nelder-Mead method will solve, but that I

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.