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

The Archive Base Latest Questions

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

I have a UITableView tied to core data. When there are no entries, I

  • 0

I have a UITableView tied to core data. When there are no entries, I hack the table to make sure that #sections = 1, #rows = 1, and that this row displays text that says “your table is empty; add a new item using the + button”.

When the user adds his first item by clicking the + button, though, core data throws an exception saying that the number of rows after the update (1) is not equal to the number of rows before the update (1) plus or minus (1 inserted, 0 deleted). This makes sense, because Core Data presumably queries the same functions that my tableview does (numberOfSectionsInTableView and numberOfRowsInSection:section). But how do I tell core data that I was lying to the tableview, and that the number of rows before the update was actually 0?

  • 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-15T14:25:55+00:00Added an answer on May 15, 2026 at 2:25 pm

    Okay, I think I thought of a really hacky way to deal with this problem in the event that I did keep a single UITableView. Writing it down in case this is helpful in the future.

    Basically, create a BOOL isUpdating to record whether we’re currently in the middle of updating the table. The implementation numberOfRowsInSection:section should check whether self.isUpdating is true; if it is, then return the “lie” number of rows (i.e. the number that the NSFetchedResultsController expects the table to have), otherwise return the number of rows to tell the tableview. Then set isUpdating to true in controllerWillChangeContent and back to false in controllerDidChangeContent.

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

Sidebar

Related Questions

I have a UITableView that is populated with cells by core data and an
I have a SQLite database tied to my uitableview. There are about 2000 rows,
I have a UITableView with three sections, the second section has the table that
I have a UITableView on a UIViewController. And this table has say 5 visible
I have a UITableView that I have set-up with 2 sections. The code below
Hi i have UITableView with x rows and my cell data loaded with plist
I have a UITableView with custom UITableViewCells. The table has two sections, the first
I have an UITableView that derives its data from an NSArray . In the
I have a UITableView that gets populated my a NSMutableArray. This is how I
I have a UITableView that I populate with data that i download over the

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.