开发者

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);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜