1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

NSSet containsObject

Discussion in 'iPhone/iPad Programming' started by counciler, Jan 19, 2011.

  1. macrumors newbie

    #1
    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:

    Code:
    //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"?
     

Share This Page