views:

357

answers:

1

Hello. I am currently creating a multi-view game on the iPhone platform. I have my main view start to play some background music upon loading. I then go to another view and start the game. I am trying to get the background music from the original view to stop once I start the game. I am having trouble getting the stop playing music message to my original view. Here is the relevant info:

The main view where the sound is played from is just a subView of the programViewController class called *viewController. The heading is in the programAppDelegate class.

The sound is done using the AVAudioPlayer class and plays fine when the program starts up and when I navigate to other subviews that are added on by going through the menu system.

In the view that I want to start the game, I attempt to call the instance of the class to turn of the player but anytime I use this format of code:

[viewController #######];

It gives a build error of "viewController undeclared" no matter what I put after the "viewController" in the message.I have attempted to import the programAppDelegate.h file but it still gives the same error.

I realize this might be a simple misunderstanding of the objective-c language but I cannot find any info on this issue. I am a recent convert from Java so I am trying to wrap my head around everything. Thank you for your time!

+1  A: 

"viewController undeclared" means the variable viewController cannot be found. The message you send to is irrelevant. Make sure viewController exists in that scope first.

(Do you mean self.viewController?)

KennyTM
I know I can't get the message to viewController. That is why I put the hashes afterwards. I just don't know how to make it in scope. I am in another view "secondViewController" class and need to call a method to the object in the "viewController" class but can't seem to be able to figure out how to do that.
MarcZero