title: TitleForHeaderInSection throwing EXC_BAD_ACCESS
body: <p>I am trying to create a generic <code>UITableView</code> in my iPhone app.
  I have a <code>UITableView</code> which populates the data using an array via a SELECT query loop.
  I add the data into my array and populate the array in <code>cellForRowAtIndexPath:</code>.
  I get the section header using that array and by using a sort method, I put the section headers in <code>Array1</code>.</p>
  
  <p>I would like to have <code>titleForHeaderInSection:</code> work by having section 0 be a static header name and sections 1 and later become generic, meaning the header name will come from <code>Array1</code>.</p>
  
  <p>I am not sure how can I create that logic since the app always throws <code>EXC_BAD_ACCESS</code> with the code below.</p>
  
  <p>My logic: I keep the count of the array in an <code>int</code> and see if the value is greater than 0. If it is, I add the section header for and <code>objectAtIndex:0</code>, otherwise I use the static one. But when the count gets to 2, for section 2 and <code>objectAtIndex:1</code>, it breaks and throws EXC_BAD_ACCESS.</p>
  
  <pre><code>- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
  {
      int value = [[self Array1] count];
      if(section == 0)
          return @"Countries";
  
      if (value &gt; 0) {
          if (section == value){
          return [[self Array1] objectAtIndex:section - 1];
      }
      }   
  }
  
  
  - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  
      int count = [[self Array1] count];
      return count + 1;
  }
  
  
  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section      
  {
      int value = [[self Array1] count];
      if (section == 0) {
      return [self.Array count];
      }
  
      if (value &gt; 0) {
          if (section == [[self Array1] count])  {
              NSString *initialLetter = [[self Array1] objectAtIndex:section - 1];
  
              // get the array of elements that begin with that letter
              NSArray *elementsWithInitialLetter = [self elementsWithInitialLetter:initialLetter];
  
              // return the count
              return [elementsWithInitialLetter count];
          }
      }
  
  }
  </code></pre>