title: Counting the amount of sections in tableView
body: <p>I want show the amount of sections of a tableView somewhere as a badge.</p>
  
  <p>The first problem is that I get a outcome of 0.</p>
  
  <p>I've declared a <code>int</code> in the TableViewController.h as <code>section</code>.</p>
  
  <p>In the .m file:</p>
  
  <pre><code>- (void)viewDidAppear:(BOOL)animated
  {
      self.section = [self.tableView numberOfSections];
      NSLog(@"Number of sections in tableView are %d", self.section);
  }
  </code></pre>
  
  <p>Why do I still get a 0 as outcome?
  Is there somewhere in the <code>numberOfSectionsInTableView</code> I need to count the amount of sections?</p>
  
  <p>Thanks</p>
  
  <hr>
  
  <p><strong>Update:</strong></p>
  
  <p>In the tableView I set al the <code>scheduledLocalNotifications</code>.
  I made a set of 2 notifications which are linked to each other.
  <em>So 2 rows of <code>scheduledLocalNotifications</code> in each section.</em></p>
  
  <p>This is what I have in the tableView:</p>
  
  <pre><code>- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  {
      return (int)[[[UIApplication sharedApplication] scheduledLocalNotifications] count]/2;
  }
  
  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  {
      // Return the number of rows in the section.
      return 2;
  }
  
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      static NSString *CellIdentifier = @"Cell";
  
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
      if (cell == nil) {
          cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
      }
  
      // Configure the cell...
      int rowIndex = (indexPath.section*2) + indexPath.row;
  
      // Get list of local notifications
      NSArray *localNotifications = [[UIApplication sharedApplication] scheduledLocalNotifications];
      UILocalNotification *localNotification = [localNotifications objectAtIndex:rowIndex];
  
  
      return cell;
  } 
  </code></pre>