try this!
Code:
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <AVFoundation/AVAudioPlayer.h>
@interface MainView : UIView {
AVAudioPlayer *theAudio;
}
-(IBAction)sound1;
-(IBAction)stop;
@end
MAIN:
#import "MainView.h"
@implementation MainView
- (IBAction)sound1 {
NSString *path = [[NSBundle mainBundle] pathForResource:@"sound" ofType:@"wav"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPathath] error:NULL];
theAudio.delegate = self;
[theAudio play];
}
- (IBAction) stop {
[theAudio stop];
}