title: How to get display data in UITableView Section tables with single Array
body: <p>I have data on a server which I want to show in the a tableView. </p>
  
  <p>The problem is that I want to show data based on categories so I have array categories which has categories which will be section titles and inside them there data so for display the data in section I have to declare Array.</p>
  
  <p><strong>e.g.</strong> If there are three categories then we have to make three array to populate data but what if there are more categories as categories are dynamic and come from server.</p>
  
  <pre><code>   - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  return [categoryArray count] ;
      }
  </code></pre>
  
  <p>And how to set title for section title, as it is in category array, so if it is section one by one in array.</p>
  
  <pre><code>    - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
    {
  
  
      NSLog(@"Number of Sections");
      if(section == 0)
       return @"Sales";
      if(section == 1)
      return @"Soft Skills";
  }
  </code></pre>
  
  <p>How to show data in tableView cells may I create arrays for all the categories?</p>
  
  <pre><code>    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  
  
  if (section==0)
  {
  
      appDelegate = (MultipleDetailViewsWithNavigatorAppDelegate *)[[UIApplication sharedApplication] delegate];
  
      int count=[resultArray count];
  
      NSLog(@"resultArry Row Counts is %d",count);
  
      return [resultArray count];
  
  }
  else{
      appDelegate = (MultipleDetailViewsWithNavigatorAppDelegate *)[[UIApplication sharedApplication] delegate];
  
      int count=[resultArrayOne count];
  
      NSLog(@"resultArry Row Counts is %d",count);
  
      return [resultArrayOne count];
  }
       }
  
  
  
  
         - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath     
      {
  
  NSLog(@"Table Cell Data");
  
  
       static NSString *CellIdentifier = @"Cell";
  
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
      if (cell == nil) {
      cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
      }
  
  cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
  
  
  if (indexPath.section==0) {
  
  
  
      appDelegate = (MultipleDetailViewsWithNavigatorAppDelegate *)[[UIApplication sharedApplication] delegate];
  
  
      ObjectData *theCellData = [resultArray objectAtIndex:indexPath.row];
      NSString *cellValue =theCellData.sub_Category;
      cell.font=[UIFont fontWithName:@"Helvetical Bold" size:14];
      NSLog(@"Cell Values %@",cellValue);
      cell.textLabel.text = cellValue;
  
      return cell;
  }
  
  else {
  
  
  
      appDelegate = (MultipleDetailViewsWithNavigatorAppDelegate *)[[UIApplication sharedApplication] delegate];
      ObjectData *theCellData = [resultArrayOne objectAtIndex:indexPath.row];
      NSString *cellValue =theCellData.sub_Category;
      cell.font=[UIFont fontWithName:@"Helvetical Bold" size:14];
  
      NSLog(@"Cell Values %@",cellValue);
      cell.textLabel.text = cellValue;
      return cell;
  
  
  
     }
        }
  </code></pre>