I have an NSPointerArray
and in one of my methods, I want to access the objects stored in that NSPointerArray
(as I have to use one of the object's properties
). I don't want to create a new NSArray
with the allObjects method as that will be redundant in my program. Right now, I'm doing the following which uses a lot of memory
? (Sorry, I'm a noob).
-(void) print
{
for (int i=0; i<[list count]; i++){
NSLog(@"%@",[((__bridge Song*)[list pointerAtIndex: i]) title]);
}
}
Thanks
It looks like your problem is already solved. Wanted to mention its easier to loop over your
NSPointerArray
with aforeach
loop. In this case you do it like this:This way you can concentrate on the object instead of using the
integer
of your loop.