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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:18:06+00:00 2026-05-12T17:18:06+00:00

I have a UIView (created in IB) with a grouped UITableView as a subview.

  • 0

I have a UIView (created in IB) with a grouped UITableView as a subview. Below this table view is a UIButton. The XIB containing the view will be loaded by a few different viewcontrollers, and so the contents of the table view can vary between one and four cells.

Here’s what I want to achieve: when the view loads, the height of the tableview (tableView.frame.size.height) should be adjusted depending on the number of cells, and the button should be placed just beneath the table view.

Can this be done? Could it somehow be done if the view is created programmatically?

Thanks in advance

Edit: Pxl’s suggestion was just what I was looking for. A while later, the need arose to have more than just a button below the table view – this was accomplished by creating a separate view containing everything I needed, and implementing the tableView:viewForFooterInSection: and tableView:heightForFooterInSection: functions.

A note for those of you trying to do the same thing: the tableview has to be programmatically created if you want different heights for the footers, or footers for only some of the sections. This is because the footer height set in IB will override the one returned from the tableView:heightForFooterInSection: function.

  • 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-12T17:18:06+00:00Added an answer on May 12, 2026 at 5:18 pm

    if there are only a handful of rows, may i suggest that you create a special UITableViewCell that contains just a button?

    then make that button cell the bottom row of the last group all the time. make the group so that it will be unlabeled and appear as if the button is sitting at the bottom of your tableview. this way you won’t have to muck around with recalculating the tableview’s frame and redrawing it.

    if the tableview will scroll due to there being many rows, then you’d be calculating the height of the tableview up to a set max (at which point the tableview will need to scroll to show more rows).

    once you’ve determined the height of the tableview you’ll need to display your rows, make a frame of the appropriate size, set the tableview’s frame to it, position the button just under the tableview, and then redraw the view.

    the layout and positioning in this case will need to be done programmatically.

    UITableview is a subclass of UIView, so you can change its frame to suit your needs just like a UIView, and UITableView will manage drawing itself to whatever frame you give it.

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

Sidebar

Related Questions

I have a UIView with a UITableView for a subview. The UIView has an
I have a .xib file containing a UIView and 2 UILabel subviews linked to
I have a UIView that gets created and added as a subview dynamically, not
I have created a UIView as a subview and to that subview I have
I have a UIView that will eventually contain about 2 screens worth of information.
I have a UINavigationController containing an UIViewController initialized with a UIView. The UINavigationController also
I am new to iphone development.I have created a UIview controller class and added
I have created a custom UIView that I would like to use on multiple
Suppose I have created a UIView , MyView , in Interface Builder, and I
I have a custom UIview which is created programmatically. How to associate to it

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.