tags:

views:

20

answers:

1

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.

A: 

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

rano
i cant able to go in that function. pls post any link regarding this topic
MaheshBabu
what do you mean by 'go in that function'?
rano