我的应用中有这个滑块
- (IBAction)slider1:(id)sender
{
UISlider *slider = (UISlider *)sender; //declare slider
NSLog(@"%f",slider.value;
}
每次应用程序从后台返回时,如何设置滑块的默认值?
UIApplicationWillEnterForegroundNotification
为通知添加观察者。
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil];
- (void)willEnterForeground:(NSNotification *)n {
self.slider.value = 0.0f;
}