for (int i=0; i<=11; ++i)
{
UIButton *numberButton = [[UIButton alloc] initWithFrame:CGRectMake(numberButtonDistance*i+1.5, 8.5, 65, 33)];
numberButton.tag = i;
if (i==0)
{
[numberButton setTitle:@"H" forState:UIControlStateNormal];
}
else if (i==11)
{
[numberButton setTitle:@"L" forState:UIControlStateNormal];
}
else
{
[numberButton setTitle:[NSString stringWithFormat:@"%d",i] forState:UIControlStateNormal];
}
[numberButton setBackgroundImage:[UIImage imageNamed:@"p_small_bg_up.png"] forState:UIControlStateNormal];
[numberButton setBackgroundImage:[UIImage imageNamed:@"p_small_bg_down.png"] forState:UIControlStateSelected];
[numberButton addTarget:self action:@selector(chooseBall:) forControlEvents:UIControlEventTouchUpInside];
[muteScrollView addSubview:numberButton];
[numberButtonArray addObject:numberButton];
}
转载于:https://my.oschina.net/u/1580121/blog/297818