title: How to add a buttons to a MutableArray according to their tag number in objective-C?
body: <p>i have a view contains many sections(group of buttons) each section in the view contains unique id, i want to add buttons to an NSMutableArray according to their id,(i.e. when the user clicks a button i get the button id then add to the array all the buttons have that id) i wrote these code, but when i check the length of the array after adding i found it to be 0 !!
  Hint: sec_0,sec_1,sec_2,sec_3,sec_4,sec_5,sec_6,sec_7,sec_8 is a predifined NSMUtable arrays.</p>
  
  <pre><code>-(NSMutableArray*)findButtonsSection:(UIButton *)buton{
  
  NSLog(@"Inside findButtonsSection");
  int tag_No=buton.tag;
  for (UIButton* bton in self.view.subviews) {
      NSLog(@"Inside findButtonsSection2");
      switch (tag_No) {
          case 0:
                  [sec_0 addObject:bton];
              NSLog(@"Number of buttons in array=%i",[sec_0 count]);
  
              break;
          case 1:
              NSLog(@"Button tag No=%i",buton.tag);
  
              [sec_1 addObject:bton];
              return sec_1;
              break;
          case 2:
              NSLog(@"Button tag No=%i",buton.tag);
  
              [sec_2 addObject:bton];
              return sec_2;
              break;
          case 3:
              NSLog(@"Button tag No=%i",buton.tag);
  
              [sec_3 addObject:bton];
              return sec_3;
              break;
          case 4:
              NSLog(@"Button tag No=%i",buton.tag);
  
              [sec_4 addObject:bton];
              return sec_4;
              break;
          case 5:
              NSLog(@"Button tag No=%i",buton.tag);
  
              [sec_5 addObject:bton];
              return sec_5;
              break;
          case 6:
              NSLog(@"Button tag No=%i",buton.tag);
  
              [sec_6 addObject:buton];
              return sec_6;
              break;
          case 7:
              NSLog(@"Button tag No=%i",buton.tag);
  
              [sec_7 addObject:bton];
              return sec_7;
              break;
          case 8:
              NSLog(@"Button tag No=%i",buton.tag);
  
              [sec_8 addObject:bton];
              return sec_8;
              break;
          default:
              NSLog(@"nnnnnnnnnn");            
      }
  
  }
  
  }
  </code></pre>