title: how to handle volume slider position in AVAudioplayer in ios
body: <p>I am creating little app that uses <code>AVAudioplayer</code> to play on audio list. I am trying to save the current volume position of the player so when he return back to audio view the volume slider will be on same position when he left off. I am trying to write some code but I don't know how to handle this functionality. Here's what I tried:</p>
  
  <pre><code>-(void)viewDidLoad
  
  {
  
  UISlider *aslider=[[UISlider alloc]initWithFrame:CGRectMake(40, 370, 220, 20)];
  
  volumeSlider=aslider;
  
  [volumeSlider addTarget:self action:@selector(volumeSliderMoved:) forControlEvents:UIControlEventValueChanged];
  
  [self.view addSubview:volumeSlider];
  
  }
  
  -(void)volumeSliderMoved:(UISlider *)sender
  
  {
  
  self.audioPlayer.volume=[sender value];
  
  }
  </code></pre>