0

hi i am new to iphone. what i did is displaying a grid of images and by selecting the image from the grid selected image will be displayed on imageview along with sound i am using the fallowing code to play audio

NSString *newAudioFile = [[NSBundle mainBundle] pathForResource:@”MusicFile”  ofType:@”mp3″];
AVAudioPlayer *audioPlayer =  [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:newAudioFile] error:NULL];

[audioPlayer play];

Now what i need is how can i get to view after completion of playing sound file post some code. thank u.

Mahesh Babu
  • 3,395
  • 9
  • 48
  • 97

1 Answers1

0

You can use – audioPlayerDidFinishPlaying:successfully: method of you AVAudioPlayer delegate (probably your UIViewController) and inside of it you can dismiss the view releasing it and doing [myView removeFromSuperview]

Have a look at this answer

Community
  • 1
  • 1
rano
  • 5,616
  • 4
  • 40
  • 66