int rand=((arc4random()%4)+1);
touch event由于生成的数字,您将如何进行int rand。
例如,如果生成的数字是1,2,2,3,4并且您有4 buttons一个标签1,2,3,4。
rand您将如何按照 int方法生成的数字的顺序制作一个必须触摸对象的事件?
int rand=((arc4random()%4)+1);
touch event由于生成的数字,您将如何进行int rand。
例如,如果生成的数字是1,2,2,3,4并且您有4 buttons一个标签1,2,3,4。
rand您将如何按照 int方法生成的数字的顺序制作一个必须触摸对象的事件?
让 4 个按钮执行一次操作
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
rand=((arc4random()%4)+1);
}
-(IBAction)我的方法{
switch (rand)
{
case 1:
//Do for first button tag
break;
case 2:
//Do for second button tag
break;
case 3:
//Do for third button tag
break;
case 4:
//Do for fourth button tag
break;
default:
break;
}
}