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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:44:20+00:00 2026-06-02T16:44:20+00:00

I’m using a custom sectionheader class with a tableview, and getting some unexpected behavior

  • 0

I’m using a custom sectionheader class with a tableview, and getting some unexpected behavior after rotation. Here’s the use case:

  1. Tap on cell in UITableView
  2. View pushed onto stack.
  3. Rotate the view to landscape.
  4. Rotate back to portrait.
  5. Pop the view.
  6. On the iPhone 3G only, a landscape-sized section header now appears stuck somewhere down the middle of the view (in addition to the portrait-sized section header, which appears, as it should, at the top of the tableview). The extraneous header scrolls with the UITableView cells, and switching away from and back to the view (the UITableView is nested within a UITabBarController) doesn’t fix the problem.

I can’t reproduce this problem on the iPhone 4, or in the Simulator. It seems that, for some reason, a landscape oriented sectionheaderview is being added to the uitableview after popping the second level view, but why would this be? Note that the same problem is reproduced when the default (and not a custom) header is used. I’ve also checked whether it’s a problem with device orientation being returned incorrectly, and that does not appear to be the case.

Here’s the init code for the custom SectionHeaderView class, if it’s helpful:

-(id)initWithFrame:(CGRect)frame title:(NSString*)title delegate:(id <SectionHeaderViewDelegate>)aDelegate {

self = [super initWithFrame:frame];

if (self != nil) {

    float lineHeight = 0.5f;
    // check line sizing for retina/non-retina
    if (![Utilities hasRetina])
    {
        lineHeight = 1.0f;
    }

    // Set up the tap gesture recognizer.
    delegate = aDelegate;        

    // Create and configure the title label.
    CGRect titleLabelFrame = self.bounds;
    titleLabelFrame.origin.y -= 12.5;
    titleLabel = [[UILabel alloc] initWithFrame:titleLabelFrame];
    titleLabel.text = title;
    titleLabel.textAlignment = UITextAlignmentCenter;
    titleLabel.font = [UIFont fontWithName:@"Georgia" size:15.0];
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.backgroundColor = [UIColor clearColor];
    [self addSubview:titleLabel];

    // add thin white line to top of section header
    UIView *topBorder = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.bounds.size.width, lineHeight)];
    [topBorder setBackgroundColor:[UIColor whiteColor]];
    [self addSubview:topBorder];
    [topBorder release];

    // Set the colors for the gradient layer.
    static NSMutableArray *colors = nil;
    if (colors == nil) {
        colors = [[NSMutableArray alloc] initWithCapacity:3];
        UIColor *color = nil;
        color = [UIColor colorWithRed:57.0/255.0 green:56.0/255.0 blue:105.0/255.0 alpha:1.0];
        [colors addObject:(id)[color CGColor]];
        color = [UIColor colorWithRed:54.0/255.0 green:53.0/255.0 blue:95.0/255.0 alpha:1.0];
        [colors addObject:(id)[color CGColor]];
        color = [UIColor colorWithRed:57.0/255.0 green:56.0/255.0 blue:105.0/255.0 alpha:1.0];
        [colors addObject:(id)[color CGColor]];
    }
    [(CAGradientLayer *)self.layer setColors:colors];
    [(CAGradientLayer *)self.layer setLocations:[NSArray arrayWithObjects:[NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:0.48], [NSNumber numberWithFloat:1.0], nil]];
}

return self;
}

Why would an additional landscape version of the custom SectionHeaderView be added in the portrait view, only on the iPhone 3G?

Thanks in advance for any help.

  • 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-02T16:44:22+00:00Added an answer on June 2, 2026 at 4:44 pm

    Still no clue what’s causing this problem, but I eventually solved it by adding a check in viewWillAppear to make sure the old header was removed.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I want use html5's new tag to play a wav file (currently only supported

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.