大家好,我需要将此代码转换为具有 2 个参数的函数,在这种情况下,第一个参数是新闻,第二个参数是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;
}