searching NSMutableArray

Discussion in 'Mac Programming' started by Jmasterman, Jul 23, 2010.

  1. Jmasterman macrumors newbie

    Joined:
    Jul 1, 2010
    #1
    I was wondering if I could search through an NSMutableArray to find an object. Then if that object fits that that description I could display its information. Like


    if ([items hasObject: itemSearchedFor])
    {
    [textField setStringValue:itemSearchedFor.name];

    }
    items is the NSMutableArray.

    Thank You in advance.:apple:
     
  2. kpua macrumors 6502

    Joined:
    Jul 25, 2006
    #2
    The docs should be your go-to place for simple questions like these.

    You're looking for -containsObject:.
     
  3. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #3
    Or -indexOfObject: or -indexOfObjectPassingTest:
     

Share This Page