title: XCode 4.2 NSArray database for tableview
body: <p>I'm a beginner i have some problem with NSArray. </p>
  
  <p>I created an array and add an new object(dataclass) to the locationArray</p>
  
  <h2>dataclass.m</h2>
  
  <pre><code>@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;
  }
  </code></pre>
  
  <h2>Table.m</h2>
  
  <pre><code>NSMutableArray *LocationArray;
  
  [LocationArray addObject:[dataclass LocationWithID:UniqueID name:name address:address latitude:latitude longitude:longitude type:type]];
  </code></pre>
  
  <p>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. </p>
  
  <p>Normally when i'm building a table i'll use </p>
  
  <pre><code>cell.textLabel.text = [LocationArray objectAtIndex:indexpath.row];
  </code></pre>
  
  <p>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.</p>
  
  <p>The code below is used to print out values for the object(dataclass)</p>
  
  <pre><code>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);
  }
  </code></pre>
  
  <h2>Screenshot</h2>
  
  <p><img src="https://i.stack.imgur.com/qug04.png" alt="enter image description here"></p>