Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JavaWizKid

macrumors 6502a
Original poster
Sep 18, 2008
572
1
How can I start and stop music in a different nib when the sound file was loaded and starts playing in another nib?

Menu.h Code
Code:
#import <AVFoundation/AVFoundation.h>


@interface Menu : UIViewController {
	
	AVAudioPlayer* backgroundMusic;

}

Menu.m Code
Code:
- (void)viewDidLoad {
	NSString *pathToMusicFile = [[NSBundle mainBundle] pathForResource:@"background" ofType:@"mp3"];
	
	backgroundMusic = [[AVAudioPlayer alloc]initWithContentsOfURL:[NSURL fileURLWithPath:pathToMusicFile] error:NULL];
	
	backgroundMusic.numberOfLoops = -1;
	backgroundMusic.volume = 0.2;
	[backgroundMusic play];
    [super viewDidLoad];
}

The class I want to control it from is options. How do I do this?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.