ios - NSMutableArray check with IndexPath -


i store touched items uicollectionview nsmutablearray, reloaddata.

my question is, how can check if indexpath.row equal of nsmutablearray objects?

i can like:

if(indexpath.row == [mymutablearray objectatindex:0]) 

but in case, check first object nsmutablearray, want check available objects if of them == indexpath.row

i'm beginner, , trying figure out.

thanks.

i'm assuming correctly storing values in mymutablearray nsnumbers.

if need know position in mymutablearray, use indexofobject::

nsuinteger position = [mymutablearray indexofobject:@(indexpath.row)]; if (position != nsnotfound) {     // handle object appearing in array } 

if need know whether object appears in array, use containsobject::

if ([mymutablearray containsobject:@(indexpath.row)]) {     // handle object appearing in array } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -