title: How does iOS's UISlider evaluate the position it's on?
body: <p>Is it linearly or logarithmically?  I ask because I'm taking a Mobile Apps directed study and we're using Sam's Teach Yourself iPhone (2nd Edition, also, booooooo!).  In Hour 8, if anyone has it, we make an animation, and we use a slider to determine how long it takes the animation to loop through.  We're then supposed to make a manual entry option for how many loops per second.  I have both of those implemented and have the slider change to what the manual entry was, but the only problem I can see is that when I enter a value in manually, it will cycle through the correct amount of loops and move the slider to the correct positioning, but whenever I set the speed of animation with the slider it seems to evaluate the values logarithmically instead of linearly.  I have a range of .05 - 19.95 for the slider, so it starts at .05 and doesn't get passed the value '1' until like 4/5 of the way through, then it's from 1-20 the rest of the way and you pretty much have no accuracy on which number you get.</p>
  <p>Thanks for your time, if you need me to rephrase something let me know!</p>
  <hr />
  <h2>*Revision</h2>
  <hr />
  <p>Okay, here we go.</p>
  <p>ImageHopViewController.h:</p>
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface ImageHopViewController : UIViewController {
      IBOutlet UIImageView *images;
      IBOutlet UILabel *hps;
      IBOutlet UISlider *slider;
      IBOutlet UIButton *toggle;
      IBOutlet UITextField *manual;
      IBOutlet UIButton *go;
  }
  
  @property(retain, nonatomic) UIImageView *images;
  @property(retain, nonatomic) UILabel *hps;
  @property(retain, nonatomic) UISlider *slider;
  @property(retain, nonatomic) UIButton *toggle;
  @property(retain, nonatomic) UITextField *manual;
  @property(retain, nonatomic) UIButton *go;
  
  -(IBAction)toggleAnimation:(id)sender;
  -(IBAction)setSpeed:(id)sender;
  -(IBAction)manualEntry:(id)sender;
  
  @end
  </code></pre>
  <p>ImageHopViewController.m:</p>
  <pre><code>#import &quot;ImageHopViewController.h&quot;
  
  #import &quot;ImageHopViewController.h&quot;
  
  @implementation ImageHopViewController
  
  @synthesize images;
  @synthesize hps;
  @synthesize slider;
  @synthesize toggle;
  @synthesize manual;
  @synthesize go;
  
  -(IBAction)toggleAnimation:(id)sender{
      if(images.isAnimating) {
          [images stopAnimating];
          [toggle setTitle:@&quot;Begin!&quot; forState:UIControlStateNormal];
      }else{
          [images startAnimating];
          [toggle setTitle:@&quot;Desist!&quot; forState:UIControlStateNormal];
      }
  }
  
  -(IBAction)setSpeed:(id)sender {
      NSString *hopRate;
      images.animationDuration=20-slider.value;
      [images startAnimating];
      [toggle setTitle:@&quot;Desist!&quot; forState:UIControlStateNormal];
      hopRate=[[NSString alloc] initWithFormat:@&quot;%1.2f&quot;, 1/(20-slider.value)];
      hps.text=hopRate;
      [hopRate release];
  }
  
  -(IBAction)manualEntry:(id)sender{
      NSString *hopRate;
      NSString *manualValue;
      float value;
      manualValue=manual.text;
      value=[manualValue floatValue];
      slider.value=value;
      images.animationDuration=1/slider.value;
      [images startAnimating];
      [toggle setTitle:@&quot;Desist!&quot; forState:UIControlStateNormal];
      hopRate=[[NSString alloc] initWithFormat:@&quot;%1.2f&quot;, 1/(20-slider.value)];
      hps.text=manualValue;
      [hopRate release];
  }
  
  - (void)dealloc
  {
      [images dealloc];
      [hps dealloc];
      [slider dealloc];
      [toggle dealloc];
      [manual dealloc];
      [go dealloc];
      [super dealloc];
  }
  
  - (void)didReceiveMemoryWarning
  {    
      // Releases the view if it doesn't have a superview.
      [super didReceiveMemoryWarning];
  
      // Release any cached data, images, etc that aren't in use.
  }
  
  #pragma mark - View lifecycle
  
  // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
  
  - (void)viewDidLoad
  {
      NSArray *animation;
      animation=[[NSArray alloc] initWithObjects:
                 [UIImage imageNamed:@&quot;frame-1.png&quot;],
                 [UIImage imageNamed:@&quot;frame-2.png&quot;],
                 [UIImage imageNamed:@&quot;frame-3.png&quot;],
                 [UIImage imageNamed:@&quot;frame-4.png&quot;],
                 [UIImage imageNamed:@&quot;frame-5.png&quot;],
                 [UIImage imageNamed:@&quot;frame-6.png&quot;],
                 [UIImage imageNamed:@&quot;frame-7.png&quot;],
                 [UIImage imageNamed:@&quot;frame-8.png&quot;],
                 [UIImage imageNamed:@&quot;frame-9.png&quot;],
                 [UIImage imageNamed:@&quot;frame-10.png&quot;],
                 [UIImage imageNamed:@&quot;frame-11.png&quot;],
                 [UIImage imageNamed:@&quot;frame-12.png&quot;],
                 [UIImage imageNamed:@&quot;frame-13.png&quot;],
                 [UIImage imageNamed:@&quot;frame-14.png&quot;],
                 [UIImage imageNamed:@&quot;frame-15.png&quot;],
                 [UIImage imageNamed:@&quot;frame-16.png&quot;],
                 [UIImage imageNamed:@&quot;frame-17.png&quot;],
                 [UIImage imageNamed:@&quot;frame-18.png&quot;],
                 [UIImage imageNamed:@&quot;frame-19.png&quot;],
                 [UIImage imageNamed:@&quot;frame-20.png&quot;],
                 nil
                 ];
      images.animationImages=animation;
      images.animationDuration=10;
      [animation release];
      [super viewDidLoad];
  }
  
  
  - (void)viewDidUnload
  {
      [super viewDidUnload];
      // Release any retained subviews of the main view.
      // e.g. self.myOutlet = nil;
  }
  
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
  {
      // Return YES for supported orientations
      return YES;
  }
  
  @end
  </code></pre>
  <p>The <code>NIB</code> file just has a <code>UIImageView</code> (images), a <code>UISlider</code> (slider) for the animation speed, a <code>UILabel</code> (hps) for displaying the &quot;hops per second&quot;, a <code>UIButton</code> (toggle) to toggle the animation, a <code>UITextField</code> (manual) for manual entry and another <code>UIButton</code> (go) to start the animation with the entered text converted to <code>float</code>.</p>
  <p>Since I have (id) for the object type that's being received, would that affect it in anyway?  I'm still new to this so how would I go about remedying this?</p>