Question

dear i need a little help here. i have to views in my project. (view1 and view2). from view1 i can navigate to view2 and i can go back form view2 to view1. view2 have w back ground music the problem is when the i go back from view2 to view1 the music still play.

to navigate from view1 to view2

[self presentModalViewController:view2 animated:YES];

to return to view1

[self dismissModalViewControllerAnimated:YES];

ii need to make music play when i lunch view2 and stop when return to view1

note: there is any function to teel application that we have navigate to view1 or view2

Was it helpful?

Solution

You can implement these methods in view2 (that I assume is a view controller).

- (void)viewWillAppear:(BOOL)animated

And start the music.

- (void)viewWillDisappear:(BOOL)animated

And stop the music.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top