Button排列

    int count = 11;

    

    for (int i = 0; i

        UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];

        [button setFrame:CGRectMake(10+(i%3)*90, 170+(i/3)*35, 70, 30)];

        [button setTag:i+400];

        [button addTarget:self action:@selector(button:) forControlEvents:UIControlEventTouchUpInside];

        [self.view addSubview:button];

    }

你可能感兴趣的:(IOS)