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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:40:35+00:00 2026-06-09T04:40:35+00:00

I have a UITableView , using a CoreData SQLLite data source and NSManagedObjectContext .

  • 0

I have a UITableView, using a CoreData SQLLite data source and NSManagedObjectContext.

Forgive me if I do not get this terminology correct, because I’ve only been at this for a few days now, so I’m just learning.

I just finished setting up a modal view to let me add new items to my data source. So, my logic right now is basically: add item to data source, refresh table view, I can now see my new item listed.

I want to take it a step farther, though, and perform a segue that I have setup that then occurs when the UITableViewCell for that any item is clicked. So I’m going to initiate that segue in code, using the performSegueWithIdentifier:sender method. The sender has to be the UITableViewCell, though.

So, given the things I have, I have the data that I just added to my data source, but do not know the index of the new item in the data source. I need to use that data to locate the UITableViewCell for the newly created item.

Any ideas on how to do this? I’ve been looking around and I have not seen any example code that looks like what I’m expecting to see.

Below is my code for adding the new item, from my modal view, to the data source:

#pragma mark - ComposeThreadViewControllerDelegate Methods

- (void)composeThreadViewController:(ComposeThreadViewController *)controller didFinishComposing:(Thread *)thread {

    // get the context
    NSManagedObjectContext *context = [(id)[[UIApplication sharedApplication] delegate] managedObjectContext];

    // add this new thread to our local cache
    NSManagedObject *managedThread = [NSEntityDescription insertNewObjectForEntityForName:@"Thread" inManagedObjectContext:context];

    [managedThread setValue:thread.id forKey:@"id"];
    [managedThread setValue:thread.title forKey:@"title"];
    [managedThread setValue:thread.author forKey:@"author"];
    [managedThread setValue:thread.text forKey:@"text"];
    [managedThread setValue:thread.location forKey:@"location"];

    //save the new thread
    [context save:nil];

    // begin refreshing the list of threads
    [self.tableView reloadData];

    // dismiss the modal view
    [self dismissModalViewControllerAnimated:YES];

    // bring up the view item view
    [self performSegueWithIdentifier:@"viewThreadSegue" sender:self];

}
  • 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-06-09T04:40:37+00:00Added an answer on June 9, 2026 at 4:40 am

    Why do you need the index path of the object? That is an implementation detail of the table view, which is managing the presentation of your objects.

    If you need the object, why not just pass the managed object as the sender?

    [self performSegueWithIdentifier:@"viewThreadSegue" sender:managedThread];
    

    Now, in your performSeque, you can pass the managed object to the view controller. No need to pollute all of your code with index paths that are unnatural to what you are doing.

    NOTE: you can ask the object for its managed object context…

    managedThread.managedObjectContext
    
    • 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 fetches data from CoreData using FetchedResultsController and it registers
How do I have a UITableView be notified that the data it is using
I am trying to use CoreData to populate a UITableView. I have been using
I've been wondering about the performance characteristics of using CoreData as a data source
I have a UITableView that's populated using core data & sqlite. I'd like to
I have a NSFetchedResultsController which displays data in a UITableView. I'm using the boiler
I am using coredata in my application to store data.i have to add the
I'm using Core Data to save my dynamic UITableView (not controller, AFAIK you can't
I'm have a weird issue here. I have a UITableView using custom UITableViewCells. Everything
I have created a UItableView using the default Xcode template and configure it to

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.