UISlider and how to keep value
<p>I'm going to list the code I have for it in all areas so you can view it. What I am trying to do is open the app with the slider at the position it was left in. It is writing the number showing in the label to the preference file just fine, I'm trying to get the slider to read that number and set itself to that number when the app is open.</p>

<p>There is some code that you'll see is just different stuff I was trying</p>

<p>This is where I'm trying to get it to open with the value. The value is written as a Number in preferences</p>

<pre><code>- (void)viewDidLoad {  
 NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];  
 NSString *last = [prefs stringForKey:@"savedNumber"];  
 if(last!=nil){  
  [_calculator setDisplay: last];  
  [displayField setText:last];  
 } 

 [sliderThing setValue: [prefs floatForKey:@"discountNumber"]];  
 NSString *disc = [prefs stringForKey:@"discountNumber"];  
 //int sliden = [disc intValue];  
 //sliderThing.value = [prefs floatForKey:@"discountNumber"];  
 sliderLabel.text = disc;  
 //[sliderthing setValue:(int) disc];  

 [super viewDidLoad];  
}
</code></pre>

<p>Where the number is shown in label and written in prefs:</p>

<pre><code>-(IBAction)sliderChanged:(id)sender
{
 UISlider *slider = (UISlider *)sender;  
 [slider setValue:((int)((slider.value + 2.5) / 5) * 5) animated:NO];  
 int progressAsInt = (int)(slider.value);  
 //int progressAsInt = [self incrementOfFive:[slider.value]];  
 //[slider setValue:((int)((slider.value + 2.5) / 5) * 5) animated:NO];  
 NSString *newText = [[NSString alloc] initWithFormat:@"%d",progressAsInt];  
 sliderLabel.text = newText;  
 NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];  
 [prefs setInteger:slider.value forKey:@"discountNumber"];  
 [newText release];  

}
</code></pre>

<p>stuff listed in .h file</p>

<pre><code>IBOutlet UISlider *sliderThing;  
@property (nonatomic, retain) UISlider *sliderThing;  
-(IBAction)sliderChanged:(id)sender;
</code></pre>
