-8
如何使用循環來創建一個10個UIButtons呈圓形與數字文本如何創建圓形10個UIButtons在for循環中
for(i=0;i<=10;i++) {
j=j+10;
UIButton *bt = [[UIButton alloc]initWithFrame:CGRectMake(10, j+10, 50, 50)];
bt.backgroundColor = [UIColor redColor];
bt.layer.cornerRadius = 0.5 * bt.frame.size.width;
[bt setTitle:@"click" forState:UIControlStateNormal];
[bt addTarget:nil action:@selector(clicked) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:bt];
}
什麼是你遇到的問題? – Carcigenicate
你爲什麼要加10到j,2次? – Honey
@親愛的,他需要指定j –