Total newbie struggling with NSMutableArray
Total newbie struggling with NSMutableArray
- Subject: Total newbie struggling with NSMutableArray
- From: John Hopkins <email@hidden>
- Date: Fri, 25 Feb 2005 13:45:00 +0000
Hi,
I hope you guys may be able to help before I throw in the towel! I have trying to get my head around the concept of ObjectiveC and cocoa for a while now, and thought I understood the basics! I have programmed a little Ansi C and thought the step would be quite straightforward. However as soon as i decided to deviate from the examples in the various books I have bought on the subject I have ground to a halt. I have searched high and low on the internet for an example but documentation is lacking. I have pondered over the ADC website, but cannot find a solution.
My scenario is this:
I have created a project in project builder with two buttons and a textfield. The first button adds my christian name to a NSMutableArray. The second button adds (or at least is supposed to add my surname to the NSMutableArray and display the two in the text field).
Here is the code that I have so far, and have tried hundreds of variations to no avail!
My Class definition:
#import <Cocoa/Cocoa.h>
@interface ArrayController : NSObject
{
IBOutlet id display;
NSMutableArray *array;
}
- (id)sender;
- (id)sender;
@end
And my implementation file:
#import "ArrayController.h"
@implementation ArrayController
- (id)sender
{
[array addObject:@"john "];
[display setStringValue:[array objectAtIndex:0]];
}
- (id)sender
{
[array addObject:@"hopkins"];
[display setStringValue:[array objectsAtIndex:1]];
}
@end
The message I get in the log window is:
2005-02-25 13:39:42.119 NSMutableArray[3957] Invalid parameter not satisfying: aString != nil
Any pointers that anyone could give, would be greatly appreciated, and you never know one day I may be able to answer one of your quieries, (though I very much doubt it at the rate I'm progressing!!!)
Regards.
John Hopkins
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden