在日期选择器中选择日期时播放点击声音的声音。现在我需要使用 UISWitch 设置我的设置模块以控制 ON 和 OFF。如何将我的声音控制设置为 uiswitch 。
-(void) switchforSounds:(id)sender
{
if ([sender isOn])
{
[Appdelegate.infoObj playback];
}
else
{
}
}
-(void) playback
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"click" ofType:@"caf"];
if (path)
{
NSURL *url = [NSURL fileURLWithPath: path];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID ((CFURLRef)url, &soundID);
AudioServicesPlaySystemSound(soundID);
}
}