Hi all. I can't figure this out.
I have an object let's call it foo.
foo has:
and that gives me an exception on the compare and exits..
thanks any help appreciated.
Ian
I have an object let's call it foo.
foo has:
Code:
NSString name;
NSInteger footSize;
NSInteger noseSize;
and I've create a:
NSMutableArray myFoo;
added a bunch of foo(s) to:
[myFoo addObject:moreFoo]; // like so //
Now I'd like to search through myFoo for someone name: @"Geoff"
and record it's index. [myfoo objectAtIndex: X] ;
I thought I could use indexOfObject:
but what is the syntax:
NSInteger findIndex;
findIndex = [myFoo indexOfObject:@"Geoff"]; // Didn't work //
findIndex = [[myFoo indexOfObject:@"Geoff"] name];
// returned a warning about NSUInteger //
can I even use "indexOfObject:" ??
I also tried:
NSInteger cardFound = 0;
NSInteger fromIndex = 0;
for (foo *inDex in myFoo) {
NSLog(@"started");
if ([[inDex name] isEqualToString: @"Geoff"]) {
cardFound = fromIndex;
NSLog(@"card found at: %@",cardFound);
break;
}
fromIndex++;
}
and that gives me an exception on the compare and exits..
thanks any help appreciated.
Ian
Last edited: