title: numberOfRowsInSection repeats counting the last section
body: <p>Possible duplicate : <a href="https://stackoverflow.com/questions/39467461/table-view-starts-with-last-section-in-numberofrowsinsection">Table View starts with last section in: numberOfRowsInSection</a>
  <a href="https://stackoverflow.com/questions/2171475/numberofrowsinsection-starts-with-last-section?noredirect=1&amp;lq=1">numberOfRowsInSection starts with last section</a></p>
  
  <p>My number of section code :</p>
  
  <pre><code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  {
      //#warning Incomplete method implementation.
      // Return the number of rows in the section.
  
   //   NSLog(@"outsideindx%d", indexsection);
      for (int indexsection = 0 ;  indexsection &lt; [arrayOfArrays count ]  ; indexsection ++)
      {
  
          NSLog(@"outsidesection%d",section);
  
          if([buttonTags containsObject:@(section)])
          {
              if (section == indexsection)
              {
                   NSLog(@"HIDING!");
                  return 0;
              }
              else
              {
               return [arrayOfArrays [indexsection] count];
              }
  
          }
  
        else
            if(section == indexsection)
          {
              //stars with 1 to 0
              return [arrayOfArrays [indexsection] count];
          }
      }
  }
  </code></pre>
  
  <p>What my code does it hides buttons in my header.
  buttonTags is an array that contains button that is clicked.
  so what i want to do is to hide button that is being clicked.
  if the value of  buttonTag is button[1], then the section == 1 will be hidden.</p>
  
  <p>if the buttonTags contains  [ 0 , 1] then the section 0  and 1 will be hidden.</p>
  
  <p>but the result is ruining the idea of my code
  the result starts with 1, where i clicked the button [0].</p>
  
  <p>The result is  like this:</p>
  
  <pre><code>insidesection: 1
  insidesection: 1
  insidesection: 0
  outsidesection: 1
  outsidesection: 0
  </code></pre>
  
  <p>The section result is different from the posted duplicates,</p>
  
  <p>My number of sections is here:</p>
  
  <pre><code>- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    //#warning Potentially incomplete method implementation.
    // Return the number of sections.
    return 2;
  }
  </code></pre>
  
  <p>What I need to start the counting of section from 0 to 1. not 1 to 0.</p>