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

  • Home
  • SEARCH
  • 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 843219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:05:25+00:00 2026-05-15T06:05:25+00:00

I have a UITableViewController, when there is no data to populate the UITableView, I

  • 0

I have a UITableViewController, when there is no data to populate the UITableView, I want to add a button, which uses an image. So, rather than the user seeing a tableview with no records, they will see an image that says, “No records have been added, Tap to add one”, then they click and we create a new one.

I assumed I would just hide the UITableView, then create the button, but I never see the button. Here I am using:

if ([[fetchedResultsController sections] count] == 0) {
        self.tableView.hidden = YES;
        // Create button w/ image
        UIButton * btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        btn.frame = CGRectMake(0, 0, 100, 50);
        [btn setImage:[UIImage imageNamed:@"no-rides.png"] forState:UIControlStateNormal];
        [self.view addSubview:btn];
    }

Ideas on why I would never see the button? When I show this view, it seems to have a transparent background for a second, then changes white…

  • 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-15T06:05:26+00:00Added an answer on May 15, 2026 at 6:05 am

    I am not sure if it works but you can try this:

    1. If your view controller is not a UITableViewController and it contains a UITableView
      [self.tableView removeFromSuperview]; then [self.view addSubview];

    2. If your view controller is a UITableViewController, you may need to consider to set the first row to contain the image and text. Then, you can handle the event: tableView:didSelectRowAtIndexPath: and if user click on the first cell, you trigger the method handle the button event

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

Sidebar

Related Questions

I have an UITableViewController which I would like to add UIToolbar to with one
I have UITableViewController which contains a list of items. Now, I want the list
I have built a UITableViewController for my app which interacts with my core data
I have a UITableViewController where the user taps an 'Edit' button (already in the
I have a UITableViewController with a subclass of UITableViewCell with a UITableView in each
I have a regular UITableViewController and a UITableView as its only view, and I
I'm using a NSFetchedResultsController and a UITableViewController to populate a UITableView from a CoreData
I have an UITableViewController which is backed by an NSFetchedResultsController. My NSFetchedResultsController put results
I have a UITableViewController , in which I added a UISearchBar as the tableHeaderView
I have a UITableViewController and intend to add a subview to it when 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.