Reputation: 1390
I have two view controllers. In the first view I added the sound in ViewDidLoad and it worked properly. When I navigate from the second view controller the to first view controller the sound is not playing.
Where should I call the sound method in first view controller?
Upvotes: 0
Views: 115
Reputation: 4921
You should play sound on viewWillAppear or viewDidAppear method because viewDidLoad will be called only once when you load the view after that it will be placed in navigation stack. ViewWillAppear will be called everytime when you show the view so play the sound in viewWillAppear or viewDidAppear
Upvotes: 4