How to retrieve objects from NSMutableArray
I am new to iPhone development. I am parsing XML data and storing its details in a custom object. I have a product class which has product id, product name, etc and I store this in an object. This object is stored in an NSMutableArra开发者_C百科y
.
I want to display the name of each product in a table row. How can I retrieve a particular object name from the NSMutableArray
?
Your question would be more clear if you put up some code you have now, but here are some ideas...
Product * product = (Product *)[array objectAtIndex:0]; //this gives you the first product in the array
And maybe...
//print out the name of each product
for (Product * product in array)
{
NSLog(@"%@", product.name);
}
精彩评论