Getting selected items in a matrix
Getting selected items in a matrix
- Subject: Getting selected items in a matrix
- From: Chris Purcell <email@hidden>
- Date: Sat, 23 Feb 2002 20:41:40 +0000
Aside from the memory leak, you haven't initialized nor incremented i.
This would give you an unterminated loop. If you don't use an
enumerator, use a for loop.
for (i = 0; i < [array count]; i++)
Kritter
- (NSString *)setDay:(id)sender
{
int i; // un-initialized variable
NSArray *array = [[NSArray alloc] init]; // memory leak
array = [dayButton selectedCells];
while (i < [array count]) {
if ([[array objectAtIndex:i] state] == NSOnState) {
// code to add the Tag of the selected item to another
array goes here
}
}
}
_______________________________________________
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.