Ios 随机调用不同操作的iAction?

Ios 随机调用不同操作的iAction?,ios,random,ibaction,Ios,Random,Ibaction,我希望我的IBAction随机选择括号中的一个操作 我该怎么做 谢谢 - (IBAction) randomAction{ [self choice1]; [self choice2]; [self choice3]; } 试试这个 - (IBAction) randomAction{ switch (arc4random()%3){ case 0: [self choice1]; break;

我希望我的IBAction随机选择括号中的一个操作

我该怎么做

谢谢

- (IBAction) randomAction{

[self choice1];
[self choice2];
[self choice3];

}
试试这个

- (IBAction) randomAction{
    switch (arc4random()%3){
        case 0:
                [self choice1];
            break;
        case 1:
            [self choice2];
            break;
        case 2:
            [self choice3];
            break;
        default:
            break;
    }
}

那很有效,谢谢!我如何在动作中循环而不是随机进行?