多个UIButtion写在UIScrowView中调用同一个点击事件
UIView: -(void)creatButton:(id)target :(SEL)sel { for (int i=0; i<3; i++) {
btn=initWithFrame:CGRectMake(i*130, 0, 100, 30)];
btn.tag=i;
switch (i)
{
case 0:
;
forState:UIControlStateNormal];
;
break;
case 1:
;
forState:UIControlStateNormal];
;
break;
case 2:
;
forState:UIControlStateNormal];
;
break;
default:
break;
}
;
}
}
UIViewController: -(void)click:(id)sender { UIButton *button = (UIButton *)sender; if (button.tag==0) scrowView.scrow.contentOffset=CGPointMake(0, 0);//点击按钮,改变UIScrowView内容的起点坐标,形成滑动效果 if (button.tag==1) scrowView.scrow.contentOffset=CGPointMake(self.view.frame.size.width, 0); }