SaveNotes *saveNotes = [[SaveNotes alloc]initWithTitleString:title descrString:descr];
[titleDescrObjects addObject:saveNotes];
[saveNotes release];
from the above code i have saved title,descr to a class SaveNotes , and then i have stored that object in my NSMutableArray -> titleDescrObjects,
Its working fine,
i need to get particular objects “descr” alone,
how to get the descr from objectAtIndex:i
i am trying
for (int i=0; i<[titleDescrObjects count]; i++)
{
NSLog(@"\n ((%@))\n",[titleDescrObjects objectAtIndex:i].descr);
}
Thanks in advance,
-objectAtIndex:returns anid. Since anidcan be of any Objective-C class, the compiler cannot associate the property.descrinto a getter, which is why it chooses not to make it valid at all.There are 3 ways to fix it.
Use a getter:
[[titleDescrObjects objectAtIndex:i] descr]Cast into a SaveNotes:
((SaveNotes*)[titleDescrObjects objectAtIndex:i]).descrUse fast enumeration. This is the recommended method.