Note the total number of buttons to be added is
-(void) addscrollandbutton{
int column=4;//number of columns
int total = self . Listarray. count;
int rows = (Total/column) + ((total% COLUMN) > 0? 1: 0);
int btnwidth=50;
int btnheight=30;
int widthblank=20;
int heightblank=20;
For (int i=0; i<total; i++) {
int row = I/column; //number of rows
int column = i% column; //Number of columns
// Add button
UIButton *abutton=[UIButton buttonwithtype: Uibuttontypecustom];
Abutton. frame=CGRectMake ((widthblank+btnwidth) *column, (heightblank+btnheight) *row, btnwidth, btnheight);
Abutton. tag=1000+i;
[Abutton settitle:[[[self. Listarray Objectatindex:i]objectforkey:@ "Table" ]objectforkey:@ "Title" "Forstate:uicontrolstatenormal
[Abutton settitlecolor: [uicolor graycolor] forstate: UIControlStateNormal];
[Abutton setshowstouchwhenhighlighted:YES]; set the highlight when pressed
[Abutton addTarget:self Action:@selector(buttonpressed:) forcontrolevents: UIControlEventTouchUpInside];
[self.view Addsubview:abutton];
}
}
-(void) buttonpressed: (ID) sender
{
UIButton * button = (UIButton *) sender;
int index=button. Tag-1000;
}
iOS implements the addition of a row row column button