Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-25-2012, 03:03 PM   #1 (permalink)
Registered Member
 
Join Date: Jun 2011
Posts: 23
Chizbang is on a distinguished road
Default *Please remove, made a better post* Background Music and menus....

Hey!
Im making this iPhone game.
Im using the AVAudioPlayer to play music in the background on the main menu.
But the issue is, when ever I go to load up a different view (Like: About, Options. I want the main menu music still playing on these views), and go back to the main menu, the track that is currently playing will still play, but then another one plays on top of it. The music code is in a custom method which is called by viewDidLoad.

How do I stop it from doing this (let me rephrase this) How do I do it properly??
I have tried using the method applicationDidFinishLoading (I used it in the AppDelegate) to call the -(void) playMusic custom function in my main menu view controller. and it works just fine, but when I go to the start game view (which is where the game takes place) it cannot stop the music that is playing (I use: [ProjectNameViewController stopMusic] "stopMusic" is a method that stops the music from playing. The reason why I want the music to stop is because I want the track to restart when the game starts).
The views are loaded like this:
BlahBlahViewController * blahOne = [[BlahBlahViewController alloc] initWithNibName:@"BlahBlahViewController" bundle:[NSBundle mainBundle]];
[self.view addSubview:blahOne.view];
I know its not ideal, but how else can I do it?


Thanks!

Last edited by Chizbang; 02-01-2012 at 10:44 AM.
Chizbang is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 392
11 members and 381 guests
Atatator, condor304, FrankWeller, glenn_sayers, iphonedevshani, MAMN84, mraalex, PowerGoofy, QuantumDoja, tim0504, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,674
Threads: 94,123
Posts: 402,908
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Atatator
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:53 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0