On 1 Sep 2012, at 9:09 AM, Kévin Vavelin <vavelinke...@icloud.com> wrote:

[In AddViewController, a child view controller. I _presume_ it was initialized 
by a MasterView[Controller] and pushed onto the navigation controller, but the 
code the OP presents does not show this. The child does not have a pointer back 
to the initial controller.]

> - (IBAction)addName:(id)sender
> {
>    MasterViewController *parentView = [[MasterViewController alloc] init];
>    [parentView setNameCategory:nameTextField.text];
>    [parentView.categoryArray addObject:nameTextField.text];
>    NSLog(@"%@", parentView.nameCategory);
>    NSLog(@"%@", parentView.categoryArray);
>    [self dismissModalViewControllerAnimated:YES];
> }

You want to influence the content and appearance of the previous, existing 
MasterView. Why are you creating a new MasterView instead?

The usual way to implement an editor is to create some representation of the 
new object (I like to use NSDictionary) and pass that as a property of the 
editor controller. Also, let the editor controller have a weak pointer back to 
the master, and a protocol to let the master know the editor has been Done or 
Canceled, so the master can harvest the edited data (or not), and dismiss the 
editor.

Note that that way, the editor knows how to get to the actual master, and that 
unlike your code, it does not have to know anything about the master's internal 
workings.

        — F


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to