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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:52:35+00:00 2026-05-20T10:52:35+00:00

Now my problem is not one but two, which are as follows: App Requirement:

  • 0

Now my problem is not one but two, which are as follows:

App Requirement: Input details of employees and click on Save button. the name of the employee should get added in the table view. Click on a single row, details should be displayed in the detail view.

Problem 1: after clicking save button for the first time, it’s displayed in the table view but from the next clicking, it’s not displayed until and unless the app is relaunched. My code for this is as follows:

(void)saveDetails{  
  EmployeeDetailsAppDelegate *appDelegate = (EmployeeDetailsAppDelegate *) [[UIApplication sharedApplication] delegate];
  NSManagedObjectContext *context = [appDelegate managedObjectContext]; 
  NSManagedObject *newDetails;
  newDetails = [NSEntityDescription insertNewObjectForEntityForName:@"Details" inManagedObjectContext:context]; 
  [newDetails setValue:empID.text forKey:@"EmployeeID"];
  [newDetails setValue:empName.text forKey:@"EmployeeName"];
  [newDetails setValue:empDepartment.text forKey:@"EmployeeDepartment"];    
  empID.text = @"";
  empName.text = @"";
  empDepartment.text = @""; 
  [[appDelegate rootViewController]addNewObject:empName.text];
  NSError *error;
  [context save:&error];
  [self dismissModalViewControllerAnimated:YES];
}

Problem 2: This is basically not a problem but a query. On clicking a row in the table view, the employee department is displayed in the detail view. Now I want to display the employee id as well. How can I do that? My code for employee department display is:

(void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{
  if([self.array count]){
    dictionary = [self.array objectAtIndex:indexPath.row] ;
    if([dictionary objectForKey:@"EmployeeDepartment"]){            
      [dictionary objectForKey:@"EmployeeDepartment"];
      NSString *empDep = [dictionary objectForKey:@"EmployeeDepartment"];
      NSLog(@"Dep is %@",empDep);
     }
   }
   detailViewController.detailItem = [NSString stringWithFormat:@"Employee Department: %@",[dictionary objectForKey:@"EmployeeDepartment"]];
   self.navigationItem.leftBarButtonItem.enabled = YES;
}

PS: This is for iPad with Core data used as storage.

  • 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-20T10:52:36+00:00Added an answer on May 20, 2026 at 10:52 am

    when you use core-data with a UITableView you should definitely use a NSFetchedResultsController and its delegate methods.

    If I understood your first problem correctly this should solve it. And it will solve much much more problems you will have later with your data array that tries to mirror core-data objects. I say try because it obviously doesn’t work.

    In short, the NSFetchedResultsController “monitors” the core-data objects you want to display in your tableview, and if an object is changed it will tell your delegate, which will take the appropriate action (like insert or delete a row). The documentation has complete sample code for the delegate methods you have to implement.

    Regarding the second question: Change your DetailViewController so it can handle the NSManagedObject. A detailView where you can’t edit the object is usually useless, so you would need to do that sooner or later anyway.

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

Sidebar

Related Questions

I'm having (many, but for now,) one problem with a project I'm working on.
I was wondering how can I match two digits but which are not the
i m using jQuery tablsorter plugin, it's working perfect,but now problem is ... i
I would like solve the problem (now hypothetical but propably real in future) of
I set up the basic Authentication/Authorization set up, but a problem now is that
(Problem solved now, see answers below) Hello, in my app I am trying to
I'm onto problem 245 now but have hit some problems. I've done some work
I have a defined a click which works as desired in all except two.
I have an application which requires plotting two locations on google map ? One
NOTE : My problem is NOT that my links are not being replaced. But,

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.