【发布时间】:2010-10-04 19:16:27
【问题描述】:
大家好,我需要将此代码转换为具有 2 个参数的函数,在这种情况下,第一个参数是 News,第二个参数是 aif 你可以这样做吗?
-(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;
}
【问题讨论】:
标签: iphone objective-c cocoa-touch programming-languages audiotoolbox