2

3 秒あるとしましょうUIStepper
1 つの値を変更すると、数式に基づいて他のステッパーの値が変更されます。

ステッパー 1 の値は 10 です。
ステッパー 2 の値は 5 です。
ステッパー 3 の値は 3 です。

ステッパー 10 +/- 1 を変更すると、ステッパー 2 +/- 1 の値が変更される可能性があります。

これは可能ですか?

4

2 に答える 2

3

それは絶対に可能です。

次のシナリオを想像できます。

UIStepper *stepperOne = [[UIStepper alloc] initWithFrame:frame];
[stepperOne addTarget:self action:@selector(stepperOneChanged:) forControlEvents:UIControlEventValueChanged];

- (void)stepperOneChanged:(UIStepper*)stepperOne{
    //This method would be called on the target of your first stepper on UIControlEventsValueChanged

    //Decrease the value by 1
    stepperTwo.value --;

    //OR
    //Increase the value by 1
    stepperTwo.value ++;
}
于 2012-03-09T02:31:22.663 に答える