Reputation: 307
I have stored data in an array from XML Parsing. In the array I have stored latitude and longitude of the start and end point. Now I want to show the value of lat and long in the table view's cell.text. How can I access this? What syntax do I use so that I show the value of the element stored in the array? When I print to console it shows that the array has 12 objects. The values stored in the array are:
araystp= ( Step: 0x563f160, Step: 0x563f860, Step: 0x56400d0, Step: 0x56408e0, Step: 0x56410f0, Step: 0x5641990, Step: 0x5642290, Step: 0x5642ae0, Step: 0x56434a0, Step: 0x5643e80, Step: 0x56446f0, Sleg: 0x5623850 )
Upvotes: 0
Views: 114
Reputation: 1193
suppose u have use array in XML file is listofPoint in which u have add your class's object.Now u synthesize a NSMutableArray in app delegate file. And where you are doing parsing event there after completion of parsing make copy of array listofPoint to appdelegate array. and in next class define object of class which you have add in listofPoint array. And use this syntax.
yourclass *Object=[[yourclass alloc]init]; Object=[appDelegate.Array objectAtIndex:0]; NSLog(@"%f",Object.var);
it will work.
Upvotes: 1
Reputation: 5183
Following is the code to get stored value from your xml calss.
for (int i = 0 ; i <[array count];i++)
{
XmlClass *class1 = (XmlClass*) [array objectAtIndex:i];
NSString *strLat = class1.latitude;
NSString *strLong = class1.longitude;
}
Upvotes: 1
Reputation: 13180
for (int i = 0 ; i <[array count];i++)
{
YourXmlClass *x = [array objectAtIndex:i]
NSString *s = x.latitude;
NSString *s1 = x.longitude;
}
Upvotes: 0