大家好,我需要這個代碼在這種情況下,第一個參數是新聞,第二個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