开发者社区 问答 正文

关于设置滚动条的默认值

如何在每次应用返回背景时设置滚动条的默认值?

滚动条如下:

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

如何设置?

展开
收起
爵霸 2016-03-25 13:56:35 2043 分享 版权
1 条回答
写回答
取消 提交回答
  • 添加 observer 到 UIApplicationWillEnterForegroundNotification

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil];
    
    
    - (void)willEnterForeground:(NSNotification *)n {
        self.slider.value = 0.0f;
    }
    2019-07-17 19:14:10
    赞同 展开评论
问答地址: