为什么是这样?
我已经在这里看到了关于这个问题的帖子,但我已经在考虑将按钮创建在不同的 x/y 位置。
这就是我正在做的事情:
UIButton * bt1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
bt1.frame = CGRectMake(40, 40, 20, 20);
[bt1 setTitle:@"A" forState:UIControlStateNormal];
[bt1 addTarget:self action:@selector(buttonPushed) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:bt1];
UIButton * bt2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
bt2.frame = CGRectMake(80, 80, 20, 20);
[bt1 setTitle:@"B" forState:UIControlStateNormal];
[bt1 addTarget:self action:@selector(buttonPushed) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:bt2];
谢谢!