containsObject - why doesen't this work?

Posted by Emil on Stack Overflow See other posts from Stack Overflow or by Emil
Published on 2010-04-20T18:49:39Z Indexed on 2010/04/20 18:53 UTC
Read the original article Hit count: 311

Filed under:
|
|
|

Hi.

I have an array that I am trying to check wether or not an indexPath(.row) exists in.

I use this code:

if ([array containsObject:[NSNumber numberWithInt:indexPath.row]]){
    NSLog(@"Yep, it exists in there.");
}

the array consist of the numbers 3, 8 and 2. The index path loads numbers fromm 0 to 8 in a loop.

Can anybody see why this doesen't work?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about nsindexpath