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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:59:44+00:00 2026-05-11T18:59:44+00:00

The tableViewHeader property of UITableView is a UIView so I thought I would be

  • 0

The tableViewHeader property of UITableView is a UIView so I thought I would be able to add multiple sub-views to it. However, when I added the code for the segmented control the UILabel a few lines before it doesn’t draw. Rects shouldn’t be overlaping each other.

What am I doing wrong?

- (void)viewDidLoad {
[super viewDidLoad];

CGRect newFrame = CGRectMake(0.0, 0.0, self.tableView.bounds.size.width, 50.0);
UIView *trialHeaderView = [[UIView alloc] initWithFrame:newFrame];
trialHeaderView.backgroundColor = [UIColor clearColor];

UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(15.0, 10.0, 75.0, 25.0)] autorelease];
label.font = [UIFont boldSystemFontOfSize:12.0];
label.text = @"TaDa!";
label.backgroundColor = [UIColor clearColor];
label.textColor = [UIColor blackColor];
[trialHeaderView addSubview:label];
[label release];

CGRect frame = CGRectMake(80, 10, 100, 35);
UISegmentedControl *seg = [[UISegmentedControl alloc] initWithFrame:frame];
[seg insertSegmentWithTitle:@"Start" atIndex:0 animated:NO];
[seg insertSegmentWithTitle:@"End" atIndex:1 animated:NO];
[trialHeaderView addSubview:seg];

[seg release];

self.tableView.tableHeaderView = trialHeaderView;
[trialHeaderView release];

}

  • 1 1 Answer
  • 1 View
  • 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-11T18:59:45+00:00Added an answer on May 11, 2026 at 6:59 pm

    Should have updated this earlier…I had autoreleased AND released the same object. silly me…

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

Sidebar

Related Questions

I'm using the code below in the root view controller to hide the UITableView's
I have a tableViewHeader UIView that contains a few dynamic elements (UILabels with varying
I have add a view with button in UITableView Header . I have set
Question is pretty clear I guess. I have a UISegmentedControl as my tableViewHeader. I
First a little background info: I have UIViewController that contains a UITableView. In the
For performance sake it is usual to reuse UITableView' cells. Is there a way
I've got a UITableView that I'd like to stick a 44px subview on top
I sorted the NSTableColumn using the sort descriptors . I used the following code
I'm having trouble changing the section header for my grouped uitableview. I have tried
I'd like to have a tableview header that can remain at the top of

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.