Calling a method from another view in objective-c. (iphone sdk).
Posted
by MarcZero
on Stack Overflow
See other posts from Stack Overflow
or by MarcZero
Published on 2010-03-27T15:54:17Z
Indexed on
2010/03/27
16:03 UTC
Read the original article
Hit count: 163
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!
© Stack Overflow or respective owner