I understand your question partially . See if following helpful :
In your scroll view :
for (int i=0;i<array;i++)
{
UIButton *button=[[UIButton alloc]initWithFrame:CGRectMake(scrollWidth, 5,50,40)];
button.userInteractionEnabled=YES;
UITapGestureRecognizer *rcognizer=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(buttonSelcted:)];
[button addGestureRecognizer:rcognizer];
[scrollView addSubview:button];
scrollWidth=scrollWidth+80;
}
In buttonSelected method just do following :
-(void)buttonSelected:(UITapGestureRecognizer *)recognizer
{
UIButton *selectedItem=(UIButton*)recognizer.view;
//do what you want with button
}