PDA

View Full Version : NSSet containsObject




counciler
Jan 19, 2011, 03:52 PM
I'm trying to determine if an object is being touched. I have a two dimensional array of what we'll call "foo"s called "fooArray." I've tried using NSSet's containsObject, I've tried detecting the entire array and even an individual object. Here's some specifics:


//Trying to detect the entire array.
if([touches containsObject: fooArray]
NSLog(@"True");

//Trying to detect the individual object in the array.
if([touches containsObject: [[fooArray objectAtIndex: 0] objectAtIndex: 0]];
NSLog(@"True");

//Trying to detect an independent object outside of the array.
if([touches containsObject: fooInstance;
NSLog(@"True");


I take it from Apple's reference that containsObject: searches the entire NSSet for the object you specify. Unless I shouldn't be using the "touches" argument supplied with the "touchesBegan" method, then I don't know what else to use. So how do I get it to return "True"?