• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Simple Messaging/NSMutableArray question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simple Messaging/NSMutableArray question


  • Subject: Simple Messaging/NSMutableArray question
  • From: "Paul Naro" <email@hidden>
  • Date: Tue, 22 Oct 2002 14:21:50 -0600

This is most likely a simple answer, but I haven't been able to find
it! I have a window with 2 NSTableViews. There are 2 classes that
when a button is clicked, it adds some text to the appropriate array
and does a reloadData on the tableView. Everything is fine at this
point. I call object 1 from object 2 like this ...

- (IBAction)copyRecord:(id)sender {
[self addToArray];
TestArray1 *aCopy = [[TestArray1 alloc] init];
[aCopy addToArray:@"This is a copied String"];
[aCopy release];
}

It passes the string to object A (I can print it out), but doesn't get
added to the array. My init methos looks like this:

- (id)init {
if (self = [super init]) {
array1 = [[NSMutableArray alloc] init];
}
return self;
}

It DOES work fine when I pass a nil to the same method. Here is the
method for adding to array1:


- (void)addToArray:(NSString *)theString {
if (theString == nil) {
theString = @"This is some text"; // Default
}
[array1 addObject:theString];
currentIndex = [array1 count] - 1 ;
[arrayTable1 reloadData];

}

I have he DISTINCT feeling it ought to b very easy, but I am obviously
missing something. All I want to do is send a string from one object
and have it populate an array in another object. When I do this, the
currentIndex stays at 0 (instead of adding it to the array as I expect
it to. TIA

Regards,

Paul Naro
Xcel Technologies, Inc.
719-332-4884
http://www.xceltech.net/
AOL IM: PaulNaro
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • RE: Simple Messaging/NSMutableArray question
      • From: "Jonathan E. Jackel" <email@hidden>
    • Re: Simple Messaging/NSMutableArray question
      • From: Ondra Cada <email@hidden>
References: 
 >Localized Country Names (From: Antonio Ferraioli <email@hidden>)

  • Prev by Date: Localized Country Names
  • Next by Date: NSMenu setMenuBarVisible
  • Previous by thread: Localized Country Names
  • Next by thread: Re: Simple Messaging/NSMutableArray question
  • Index(es):
    • Date
    • Thread