0

我的应用中有这个滑块

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

每次应用程序从后台返回时,如何设置滑块的默认值?

4

1 回答 1

2

UIApplicationWillEnterForegroundNotification为通知添加观察者。

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


- (void)willEnterForeground:(NSNotification *)n {
    self.slider.value = 0.0f;
}
于 2013-02-16T14:36:25.287 回答