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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:09:31+00:00 2026-05-27T12:09:31+00:00

While in the Interface Builder, it’s pretty easy to add an UIView to an

  • 0

While in the Interface Builder, it’s pretty easy to add an UIView to an UITable and show it correctly, just drag and drop and it’s done. But now that’s gonna be optional, so it has to be placed programmatically.

Here’s how it looked like in the interface builder:
How it looked like in the Interface Builder

When I added the new view as a subview, it showed on top of the UITableView-content, but the content should have some offset. I tried it with the following code:

self.scrollView.frame = CGRectMake(0, -140, self.scrollView.frame.size.width, self.scrollView.frame.size.height);
[self.tableView addSubview:self.scrollView];
[self.tableView setContentInset:UIEdgeInsetsMake(140,0,0,0)];
[self.tableView setContentOffset:CGPointMake(0, -140) animated:NO];

That seemed to work, it shows correctly.. But when I scroll down, the section header stays at 140 pixels from the top. So I guess I’m using the wrong approach, but have absolutely no idea how to fix it. Could anyone give me a push in the right direction?

  • 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-27T12:09:31+00:00Added an answer on May 27, 2026 at 12:09 pm

    Okay, I feel really stupid. After hours of trying, I thought of something.. Just checked the source of the .xib file and compared the one with the subview with the one without. The following things showed up:

    • The UIView was part a subview of the UITableView.
    • The following reference was added: <reference key="IBUITableHeaderView" ref="204195654"/>.

    So, changed the code to this:

    [self.tableView addSubview:self.scrollView];
    [self.tableView setTableHeaderView:self.scrollView];
    

    And it works!

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

Sidebar

Related Questions

I made a UIView using Interface Builder with a top bar that has Cancel
While designing an interface for a class I normally get caught in two minds
I want to leverage the Scala's Actor Framework while I develop the user interface
Anyone had a smiliar bug? The control is placed from Interface Builder and not
Apple has a nice little tutorial for making a simple master-detail interface. Interface Builder
It's pretty embarrassing asking this because I've been building apps for a while now.
I've been programming for a while, but just recently decided to start developing for
I have a toolbar with various image buttons, created in Interface Builder. I'd like
in Xcode 3.2 Interface Builder there was a UIButton Send Event called touch hold.
I'm the programmatic guy, and I simply don't want to use Interface Builder. 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.