大家好,我需要这个代码在这种情况下,第一个参数是新闻,第二个AIF u能做到这一点转化为函数有两个参数?转换代码的功能
-(IBAction)news
{
CFURLRef soundFileURLRef;
SystemSoundID soundFileObject;
CFBundleRef mainBundle;
mainBundle = CFBundleGetMainBundle();
// Get the URL to the sound file to play
soundFileURLRef = CFBundleCopyResourceURL (mainBundle,
CFSTR ("News"),
CFSTR ("aif"),
NULL);
// Create a system sound object representing the sound file
AudioServicesCreateSystemSoundID (soundFileURLRef, &soundFileObject);
AudioServicesPlaySystemSound (soundFileObject);
return;
}
你好,谢谢你的回答,这是我想要的,但是当我写PlayNews时:@“news1”ofType:@“wav”; Xcode给我一个错误:预期';'在'type'之前,你能帮我解决这个问题 – 2010-10-04 20:24:53
你需要把它放在尖括号中:[obj playNews:@“news”ofType:@“wav”]; – Codo 2010-10-04 21:17:10