I’m a beginner i have some problem with NSArray.
I created an array and add an new object(dataclass) to the locationArray
dataclass.m
@synthesize UniqueID,name, address, latitude, longitude, type;
+ (id)LocationWithID:(NSString *)UniqueID name:(NSString *)name address:(NSString *)address latitude:(NSString *)latitude longitude:(NSString *)longitude type:(NSString *)type
{
agilentLocation *newLocation = [[self alloc] init];
newLocation.UniqueID = UniqueID;
newLocation.name = name;
newLocation.address = address;
newLocation.latitude = latitude;
newLocation.longitude = longitude;
newLocation.type = type;
return newLocation;
}
Table.m
NSMutableArray *LocationArray;
[LocationArray addObject:[dataclass LocationWithID:UniqueID name:name address:address latitude:latitude longitude:longitude type:type]];
I would like to ask how could I call the value under my dataclass. For example I need to call the name under the dataclass for my table title.
Normally when i’m building a table i’ll use
cell.textLabel.text = [LocationArray objectAtIndex:indexpath.row];
but in this case there is only one object which is “dataclass” but it has several objects under it.
how should i display the name on the table.
The code below is used to print out values for the object(dataclass)
for (dataclass *theLocation in LocationArray) {
NSLog(@"Name: %@ Address: %@ Latitude: %g Longitude: %g Type :%@", theLocation.name, theLocation.address ,[theLocation.latitude doubleValue], [theLocation.longitude doubleValue], theLocation.type);
}
Screenshot

Please Note that the LocationArray should be a class variable. Public or Private based on your convenience.
Hope this is what you are looking for…