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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:41:16+00:00 2026-05-31T19:41:16+00:00

I’m new to programming and some OOP concepts and am not sure what is

  • 0

I’m new to programming and some OOP concepts and am not sure what is the “right” way to do something. Basically what I have is an NSMutableArray in my mainViewController.

MainViewController: UITableViewController 

@property (nonatomic, retain) NSMutableArray *data;

A plus button can be pressed to add an item to the Table, or if an already existing row is selected, the current item can be edited. I’m not sure what the best way to structure my DetailViewController since the DetailViewController can be presented from either the plus button or a table row selection. Do I set a flag in DetailViewController that says which method presented the DetailViewController so in my Save method, I either insert the object (if the user pressed plus), or replace the object at the current index (if the user selected a row and I passed the index to the DetailViewController)? It seems kind of clunky to do it that way and was wondering what a better way to do something simple like that would be. Thanks!

  • 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-31T19:41:18+00:00Added an answer on May 31, 2026 at 7:41 pm

    Your current MainViewController setup is fine. What you want to do for your DetailViewController is define its own view. Given the description of your app it would be best if you stored each row in your table as an object:

    MainViewController: UITableViewController
    
    @property (nonatomic, retain) NSMutableArray * data ; // an entry for each row
    
    DetailViewController: UIViewController
    
    @property (nonatomic, retain) SomeObject * object; // Represents a single row
    

    When presenting your DetailViewController either:

    1. Populate its managed object with an existing row, in case user
      selects an existing item
    2. Populate it with a new managed object, that will be added to the
      master list once detail editing is done

    When your detail view controller is done, you refresh the table view.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have some data like this: 1 2 3 4 5 9 2 6
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.