gpt4 book ai didi

ios - 有没有办法根据计算以编程方式更改 UIStepper 的值?

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:16:34 24 4
gpt4 key购买 nike

假设我有 3 个 UIStepper
当我更改其中一个的值时,其他步进器的值会根据公式发生变化。

步进器一值为10。
步进二值是5.
步进器三值为3。

如果我更改步进器 10 +/- 1,它可能会更改步进器 2 +/- 1 中的值。

这可能吗?

最佳答案

这是绝对有可能的。

你可以想象这样的场景:

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 ++;
}

关于ios - 有没有办法根据计算以编程方式更改 UIStepper 的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9627856/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com