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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:19:50+00:00 2026-05-26T01:19:50+00:00

I am struggling to achieve what I thought was nothing but a 1′ coding

  • 0

I am struggling to achieve what I thought was nothing but a 1′ coding but apparently
adding a UILabel above my UITableView in a UITableViewController is not a piece of cake…?

Here is the code (yes basic, I know):

    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 310, 20)];
    [[self tableView] addSubview:label];

The result can be seen in the screenshot below, the label on the top right is just half displayed, saying “Balance…”

Please note that if I try to change CGRect origin.y or size.height the UILabel is not displayed at all.

I also tried adding the following, with no change in result:

    [[self tableView] bringSubviewToFront:balanceLabel];

I don’t care if the UILabel is scrolled up when scrolling up the UITableView, I want it to stick with the first section header.

I know this can be achieved in other ways, using a custom UIView for the header, changing to UIViewController or using a .xib, but really I would like to understand why this happens.

Thanks for any help.
F.

How the label appears

  • 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-26T01:19:51+00:00Added an answer on May 26, 2026 at 1:19 am

    It does look like the header is hiding your label, maybe you could try setting the header background to clearColor. Since you have no control on the table view loop I suspect that after your addSubView somewhere the table builds its own header and does another addSubView.

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

Sidebar

Related Questions

I'm really struggling with this piece of code. What I'm trying to achieve: I
I'm struggling to achieve folowing without temp. files. #!/bin/bash tar ztf $1 | sort
Perhaps properties aren't the way to go with this, but I'm struggling to find
Hi all I am struggling to achieve my my goal and I really need
I'm struggling to make this script work. What I'm looking to achieve is to
I have compiled and built openssl to my iOS project, but struggling in objective-c
So I thought I'd teach myself C++ but I appear to have no problems
Is there a way to achieve this? At first I thought that desctructionPolicy =
I have been struggling to imitate Launchpad. At the beginning I thought about making
I'm struggling a bit trying to achieve something that appeared simple initially to me.

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.