Я не уверен, хорошо ли я написал этот код (быстро нажимайте на прикосновения к кнопкам):
#import "iEngineRoomAppDelegate.h"
#import "iEngineRoomViewController.h"
#import "SoundEffect.h"
@implementation iEngineRoomAppDelegate
@synthesize window;
@synthesize viewController;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after app launch
[window addSubview:viewController.view];
[window makeKeyAndVisible];
[self setupSounds];
}
- (void)setupSounds {
NSBundle *mainBundle = [NSBundle mainBundle];
timbal_big_Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"timbal_big" ofType:@"caf"]];
timbal_sm_Sound = [[SoundEffect alloc] initWithContentsOfFile:[mainBundle pathForResource:@"timbal_sm" ofType:@"caf"]];
}
- (IBAction)timbal_big: (id)sender {
SoundEffect *currentSoundEffect= timbal_big_Sound;
[currentSoundEffect play];
}
- (IBAction)timbal_sm: (id)sender {
SoundEffect *currentSoundEffect= timbal_sm_Sound;
[currentSoundEffect play];
}
- (void)dealloc {
[timbal_big_Sound release];
[timbal_sm_Sound release];
[viewController release];
[window release];
[super dealloc];
}
@end