Slider Not Behaving As I Would Expect

Posted by Adam Waite on Stack Overflow See other posts from Stack Overflow or by Adam Waite
Published on 2011-11-21T17:48:07Z Indexed on 2011/11/21 17:49 UTC
Read the original article Hit count: 317

Filed under:
|
|
|
|

I have a slider that changes a float from 1 to 10 but I want to save this value and use it across all view controllers so I have saved that float as an NSNumber in a model class (settingsData.sensitivitySliderSettingValue).

I am trying to output the updated slider value to the console every time that it is changed however it just gets set to 0 rather than 0 to 10. I don't understand why this is...

Here's my code:

-(IBAction)sensitivitySliderValueChanged:(id)sender
{
    [self updateSensitivity];    
}


-(void)updateSensitivity{


    settingsData.sensitivitySettingValue = [NSNumber numberWithFloat:sensitivitySlider.value];

    NSLog(@"The Slider Value is: %1.1f", [settingsData.sensitivitySettingValue floatValue]);

}

© Stack Overflow or respective owner

Related posts about iphone

Related posts about ios