NSArray * name = @[@"1",@"2",@"3",@"4"];
for (int i = 0; i<name.count; i++) {
UIButton * btn = [[UIButton alloc]initWithFrame:CGRectMake(20+i%(name.count-1)*100, i/(name.count-1)*35, 80, 30)];
btn.backgroundColor = [UIColor purpleColor];
[btn setTitle:name[i] forState:UIControlStateNormal];
[btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
[btn setTitleColor:[UIColor redColor] forState:UIControlStateDisabled];
[btn addTarget:self action:@selector(cilck:) forControlEvents:UIControlEventTouchUpInside];
btn.tag = i+20;
[self.view addSubview:btn];
}