title: UITableView grouping sections from NSMutableArray
body: <p>I have an app that basically reads an xml file and displays the results in a UITableView. I am trying to group the list items by "country" (an attribute of the xml file elements) and display them in UITableView Sections.</p>
  
  <p>Currently i read the xml file and store each Element as a custom object in an NSMutableArray. The array has the following structure:</p>
  
  <p>Array:
    0 => (title, description, date, country)
    1 => (title, description, date, country)
    2 => (title, description, date, country)
    3 => (title, description, date, country)</p>
  
  <p>I have tried creating another array of unique countries which has allowed me to create the section headers correctly but i am struggling to work out a way to display the correct items beneath each section header.</p>
  
  <pre><code>if(![countryArray containsObject:itemCountry]) //if country not already in array
  {
     [countryArray addObject:itemCountry]; //Add NSString of country name to array
  }
  </code></pre>
  
  <p>Where itemCountry is the country attribute of each element as i loop through the xml file.</p>
  
  <pre><code>[countryArray count]; //gives me the amount of sections needed
  </code></pre>
  
  <p>So i guess my question is how do i work out how many rows need to go in each section?
  How do display the correct array items for each section?</p>
  
  <p>Any help or pointers would be great</p>