开发者

How to retrieve objects from NSMutableArray

开发者 https://www.devze.com 2023-03-13 19:27 出处:网络
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 obj

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

精彩评论

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