【发布时间】:2012-02-26 13:53:18
【问题描述】:
对不起,如果这是一个菜鸟问题,但我所有的代码都没有错误,我不知道如何让我按下按钮来完成所有这些事情。它在界面生成器中正确连接。无论如何,如果你能帮助我,这就是我所拥有的:
在界面中
@interface SuprisedViewController : UIViewController {
IBOutlet UIButton *marsStoryButton;
IBOutlet UIButton *marsStoryHome;
@property (nonatomic, retain) IBOutlet UIButton *marsStoryHome;
@property (nonatomic, retain) IBOutlet UIButton *marsStoryButton;
-(void)marsStoryButtonPressed;
在实现中
@implementation SuprisedViewController
@synthesize bolloLogo, scaryAlien, exorcist, image1, image2, marsMan, marsStoryButton, marsStoryHome;
-(void)marsStoryButtonPressed {
marsMan.hidden = NO;
marsStoryHome.hidden = NO;
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"longManScream", CFSTR ("wav"), NULL);
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"spressedScream", CFSTR ("wav"), NULL);
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"torturedGirlScream", CFSTR ("wav"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}
【问题讨论】:
标签: iphone objective-c action void-pointers audio