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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:55:57+00:00 2026-05-16T22:55:57+00:00

I am trying to create a UITableView that only displays the number of rows

  • 0

I am trying to create a UITableView that only displays the number of rows that have data content in them. This is a menu system, and suppose there are 5 choices in the particular menu, I only want to show 5 rows on the screen, with a background image in place of where the empty rows would be (A similar example I guess would be the World Clock). How should I go about this? I’ve trawled around but can’t find anything that helps. Many thanks.

---------------------
Menu Item 1
---------------------
Menu Item 2
---------------------
Rest of view as image




---------------------

Using a grouped table view works, but I don’t really want to use this.

  • 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-16T22:55:57+00:00Added an answer on May 16, 2026 at 10:55 pm

    Your UITableView can have a backgroundView. Set it to be a UIImageView, and set it’s frame to the table view’s bounds. This code is untested, but should give you an idea.

    UIImage * img = [UIImage imageNamed:@"myImage.jpg"];
    UIImageView * imgView = [[UIImageView alloc] initWithImage:img];
    imgView.frame = myTableView.bounds;
    myTableView.backgroundView = imgView;
    

    EDIT: The above will produce a background like world clock. to make it show below the other cells as a cell, change your data source:

    - numberOfRowsInSection:section: should return one more than before.
    - tableView:canEditRowAtIndexPath: and tableView:canMoveRowAtIndexPath: should return NO for this new cell.
    - (UITableViewCell *)tableView:cellForRowAtIndexPath: needs to create the new cell when the it is asked for, so if you have 5 data cells, the 6th will return:

    UITableViewCell * cell = //create your cell
    //change the height to match the remaining space
    UIImage * img = [UIImage imageNamed:@"myImage.jpg"];
    UIImageView * imgView = [[UIImageView alloc] initWithImage:img];
    cell.backgroundView = imgView;
    

    I am not sure if you have to set the image view size, but you do have to set the cell size to take up the remaining space, with something like this in your table view delegate’s tableView:heightForRowAtIndexPath: for the final row:

    //if final row
    return myTableView.bounds.size.height - 16.0 * myData.count; //modify from the default 16.0 as needed.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a UITableView that lists each teacher in my school
Im trying to create a listing app that is core data backed.The first page
I am trying to create programmatically a uitableview that can scroll and fit based
I am trying to create a generic UITableView in my iPhone app. I have
I'm trying to create a view programmatically. The result that i want to have
here's my issue, i'm trying to create a UITableView that is able to display
I have a UITableView populated with 27 rows. I am trying to change the
I am trying to create a table with cells that contain UITextViews inside them
I am trying to create a UITableView Section that contains two buttons aligned horizontally.
I'm trying to create a custom view for my UITableView footerView that has a

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.