title: To display UIButtons in GridView
body: <p>I have some number of buttons(5 UIButtons) and want to place them in grid view in each row i want to place 3 buttons. </p>
  
  <p>How can i place them, Any idea? </p>
  
  <pre><code>-(void)createSubMenusforView:(UIView *)selectedView
  {
  int y=75;
  
  for(int i=0;i&lt;=([arr count]-1)/3;i++)
  {
      int si=(selectedView.frame.size.width/3-50)/2;
  
      int x=si+si/2;
  
      for(int j=0;j&lt;3;j++)
      {
          UIButton *btn_item=[[UIButton alloc]initWithFrame:CGRectMake(x,y,50,50)];
          btn_item.backgroundColor=[UIColor  grayColor];
          [selectedView addSubview:btn_item];
  
          [self doAnimateforView:btn_item forFrame:CGRectMake(btn_item.frame.origin.x, btn_item.frame.origin.y, btn_item.frame.size.width, btn_item.frame.size.height) forDelay:0.5];
  
          x=x+75;
  
      }
  
      y=y+60;
  
  }
  }
  </code></pre>