问题描述
- 批量UIButton垂直显示不同名称
-
有三个不同的button,在UIView中用一个循环显示,但是只显示了一个button。float yButton = 50.0; for (int i = 0; i < 2; i++) { UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame = CGRectMake(80.0, yButton + 70.0, 160.0, 40.0); [button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchDown]; [self.view addSubview:button]; [button setTag:i]; }
如何给Button标题设置ABC?
解决方案
http://code4app.com/snippets/one/批量创建UIButton/50c191f66803fa301d000000
你看看这个批量操作的代码:
时间: 2024-10-30 15:32:21