NSArray problems
NSArray problems
- Subject: NSArray problems
- From: "LANCE GREENWOOD" <email@hidden>
- Date: Sat, 01 Feb 2003 08:27:43 -0700
This is a two part question both using NSArray:
I have 5 switches and the user can check as many of them as they want, and
then press a button to process the checked buttons. I found in the
documentation "selectedCells" which is going to return an NSArray with the
check switches. Therefore, my code look like this:
//switchOulet is an outlet connected to the switch matrix.
-(IBAction)switchButton:(id)sender
{
int x;
NSArray *myArray;
myArray = [[NSArray alloc] initWithObjects: [switchOutlet
selectedCells]];
x = [myArray count];
}
x = 1 all the time and myArray always has nothing in it, can anyone help in
solving this problem and point me in the correct direction.
The second part of the question also has to do with NSArray, I want to be
able to get a list of the current directory so I used
"directoryContentsAtPath" When I call this function it never returns. My
code looks like this:
- (IBAction)dirAction:(id)sender
{
int i;
NSFileManager *fileManager;
NSArray *myArray;
fileManage =[[NSFileManager alloc] init];
fileManager =[NSFileManager defaultManager];
myArray = [[NSArray alloc] init];
myArray = [fileManager directoryContentsAtPath:@"Macintosh
HD/Applications"];
i = [myArray count];
}
Any help that can be given would be greatly appreciated.
Thanks
Lance
_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
_______________________________________________
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.