Hello!
Does nsarray count return the NUMBER of objects (I.E. the first object would be 1, etc) or does it return the max index of the object (I.E. the first one would be 0);
Thanks, Christian Stewart
Hello!
Does nsarray count return the NUMBER of objects (I.E. the first object would be 1, etc) or does it return the max index of the object (I.E. the first one would be 0);
Thanks, Christian Stewart
It returns the total number of objects. For example, if you have an object at index 0, 1, and 2, then it will return a count of 3.
It returns the total number of objects within the array, not the index.
NSArray *fastFoodPlaces = [NSArray arrayWithObjects:@"McDonalds", @"Burger King", @"Taco Bell", nil];
NSLog(@"Total Number of Objects: %i",[fastFoodPlaces count]);
Returns:
2010-08-29 18:25:50.963 StackOverflow[848:a0f] Total Number of Objects: 3
Nevermind, just saw the other two posts >.<