I took a lot of this example from Hillegass "speakline". What I wrote has three textboxes and two buttons. The idea is to input into the first box, names (or strings), to go into an array. In the second box you input the integer whose array element you are trying to see. I got the program to run, but it stops at the second input (that is, it allows you to input the names, but when you put the integer in it stops). Below is my code.
The error that comes out is the following --
2008-12-06 21:06:49.106 firsttryarray[260:10b] *** -[NSTextField mySecondString]: unrecognized selector sent to instance 0x127e70
Thanks.
Adam
Code:
#import <Cocoa/Cocoa.h>
@interface firsttryarrayadam : NSObject {
IBOutlet NSTextField*input1;
IBOutlet NSTextField*input2;
IBOutlet NSTextField*output;
NSMutableArray*myArray;
NSString*myInputArray;
NSString*mySecondString;
NSNumber*myInt;
}
-(IBAction)asmbutton1:(NSButton*)sender;
-(IBAction)asmbutton2:(NSButton*)sender;
@end
#import "firsttryarrayadam.h"
@implementation firsttryarrayadam
-(id)init
{
[super init];
myArray=[[NSMutableArray alloc]init];
return self;
}
-(IBAction)asmbutton1:(NSButton*)sender;
{
myInputArray=[input1 stringValue];
[myArray addObject:myInputArray];
}
-(IBAction)asmbutton2:(NSButton*)sender;
{
myInt=[input2 intValue];
mySecondString=[myArray objectAtIndex:myInt];
[output mySecondString];
}
@end
The error that comes out is the following --
2008-12-06 21:06:49.106 firsttryarray[260:10b] *** -[NSTextField mySecondString]: unrecognized selector sent to instance 0x127e70
Thanks.
Adam