NSMutableArray access from other class

  • hello!
    ive got a Window Panel with a nice NSTableView.
    I called the class "MyClass" where delegate and dataSource.
    Ive got 2 colums where I have assigned the identifer as "param" and
    "paramValue".
    Till here nothing to worry. I just implemented the delegates and the
    chance to edit the cells.

    Ive got even two NSMutableArray and a NSDictionary.

    -(id)init{
    [super init];
    params = [[NSMutableArray alloc] init];
    paramsValue = [[NSMutableArray alloc] init];

    extraDictArray = [[NSMutableDictionary alloc] initWithCapacity:2];
    [extraDictArray setObject:params forKey:@"param"];
    [extraDictArray setObject:paramsValue forKey:@"paramValue"];

    return self;
    }

    - (int)numberOfRowsInTableView:(NSTableView *)tableView {
    return [params count];
    }

    - (id)tableView:(NSTableView *)tableView
      objectValueForTableColumn:(NSTableColumn *)tableColumn
      row:(int)row {
    NSParameterAssert(row >= 0 && row < [params count]);
    NSArray *theValue = [extraDictArray objectForKey:[tableColumn
    identifier]];
    return [theValue objectAtIndex:row];
    }

    - (void)tableView:(NSTableView *)aTableView
      setObjectValue:(id)anObject
      forTableColumn:(NSTableColumn *)tableColumn
      row:(int)row {
    NSString *value = [[extraParamsTable selectedCell] stringValue];

    NSArray *theArray = [extraDictArray objectForKey:[tableColumn
    identifier]];
    [theArray replaceObjectAtIndex:row withObject:value];
    }

    and just for the record ive got an NSTextView where I print out the
    param and the paramValue
    so I know that it works.All the datas into the two array are added
    with no problem and everything works fine.
    Now Ive got another class "MySecondClass", where I do want access this
    two NSMutableArray,
    so I do this:

    - (IBAction) updateParams:(id) sender{
    int row = [masterList selectedRow];
    NSLog(@">> %@",[[masterObj objectAtIndex:row] valueForKey:@"params"]);
    }

    what Ive got here is always an empty array..why?
    call a metod (selector) inside the Panel (so the "MyClass") works, but
    from another class it doesnt works.
    If I call another object like an NSString *test =@"hello!": like

    NSLog(@">> %@",[[masterObj objectAtIndex:row] valueForKey:@"test"]);

    it works..:( have no clue at all why.
    and If I add some object inside the arrays outside the delegate method
    (ex in the init method)

    -(id)init{
    [super init];
    params = [[NSMutableArray alloc] init];
    [params addObject:@"goofy1"];
    [params addObject:@"goofy2"];

    return self;
    }

    I get the array with the objects inside.It works.
    any solutions?

    tnx guys.
previous month february 2008 next month
MTWTFSS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29    
Go to today