views:

263

answers:

2

How to know at runtime how many array elements are there in NSMutableArray?

+2  A: 

NSArray (NSMutableArray is a subclass of NSArray) has a count method.

Example:

NSUInteger arrayLength = [ myMutableArray count ];

Jacob Relkin
ok .. thanks.. can i access the names of elements ?? do we have any method to access the names at index?
suse
names as in keys? you'll need to use an `NSDictionary` for non-numeric indexes.
Jacob Relkin
A: 

By reading the documentation for the class you are interested in.

willcodejavaforfood
At least explain the concept that NSMutableArray inherits from NSArray...
mark
@Mark - You learn that by reading the documentation...
willcodejavaforfood