gpt4 book ai didi

iphone - iOS - 每次应用程序从后台返回时如何设置 slider 的默认值?

转载 作者:行者123 更新时间:2023-11-28 22:39:43 24 4
gpt4 key购买 nike

我的应用程序中有这个 slider

- (IBAction)slider1:(id)sender
{
   UISlider *slider = (UISlider *)sender;  //declare slider
   NSLog(@"%f",slider.value;
}

每次应用从后台返回时如何设置 slider 的默认值?

最佳答案

UIApplicationWillEnterForegroundNotification 通知添加一个观察者。

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil];


- (void)willEnterForeground:(NSNotification *)n {
self.slider.value = 0.0f;
}

关于iphone - iOS - 每次应用程序从后台返回时如何设置 slider 的默认值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14911392/

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