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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:56:21+00:00 2026-05-12T07:56:21+00:00

I have application with following design: Table View that lists documents. And ViewController where

  • 0

I have application with following design:
Table View that lists documents.
And ViewController where document is edited.

When editing the document I want to use a copy of object so in case user press Cancel I just throw away the copy. If user selected Save I copy modified document to original.
(I can’t have all document’s fields as properties in viewController because there are too many of them).

Table View controller:

SelectedRowAtIndex {
  document= [documentsArray objectAtIndex:indexPath.row];
  viewController.assignedDocuemnt= document;
}

Then I have View controller class where the item is modified:

@interface
@property (nonatomic,retain) Document *asignedDocument;
@property (nonatomic,retain) Document *editedDocument;

viewDidLoad{
   editedDocument= [assignedDocuemnt copy];
}


IBAction save {
   assignedDocument=editedDocument;
}

My problem is that original document in documentsArray is not updated with edited version.
What did I miss?

  • 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-12T07:56:22+00:00Added an answer on May 12, 2026 at 7:56 am

    You’re copying the value and then assigning the reference of the copy back over a reference to the original. That’s definitely not going to work.

    First, keep track of which document they’re adding in the table view’s viewcontroller.

    Then add a handler for replacing the selected document with another to the table view’s viewcontroller:

    - (void)replaceSelectedDocument:(Document*)newDoc {
        [documents replaceObjectAtIndex: editingIndex
                             withObject: newDoc];
    }
    

    To save, call the table view controller’s new message from the editor view controller with something like:

    [tableViewController replaceSelectedDocument: editedDocument];
    

    A better way to do this would be to modify your editor view controller to take a target and action instead of calling back to the table view controller explicitly. When you want to save, call the action:

    [target performSelector: action withObject: editedDocument];
    

    But that’s another bump on the learning curve that you probably don’t need to get over today.

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

Sidebar

Ask A Question

Stats

  • Questions 164k
  • Answers 164k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Edited: You can try the following: p { letter-spacing: 1000px;… May 12, 2026 at 12:24 pm
  • Editorial Team
    Editorial Team added an answer You should clone your pager object, but be careful with… May 12, 2026 at 12:24 pm
  • Editorial Team
    Editorial Team added an answer This sounds like the Client's server is not set up… May 12, 2026 at 12:24 pm

Related Questions

I'm new to iPhone development, and multiple views (xib or nib) are really confusing
I'm struggling with the design of a django application. Given the following models: class
Is there any name for the following DB table design: Basically we have generic
I have a Silverlight application that communications with an ASP.NET backend through WCF. I
I have two tables, we'll call them Foo and Bar , with a one

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.