の位置を特定:次のように、私は5つのボタンを動的に作成したUIButton
float xpos=0,ypos=0;
for (int i = 0; i < 5; i++)
{
but = [UIButton buttonWithType:UIButtonTypeCustom];
[but setTag:i];
[but setImage:[UIImage imageNamed:@"btfrnt.png"] forState:UIControlStateNormal];
[but setFrame:CGRectMake(xpos, ypos, 40, 40)];
xpos+=80;
[but addTarget:self action:@selector(checkboxButton:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:but];
}
ボタンのいずれかのClickイベントでは、私は私がクリックしたボタンの位置を見つけたいです。 ...
-(void)checkboxButton:(UIButton*)sender
{
NSLog(@"%d",xpos);
}
しかし、それは、そのタグを用いて、それを識別するために、どのような方法があります...最後のボタンの唯一のXPOSを表示しますか?
おかげで.... – Icoder