【发布时间】:2011-01-28 08:19:52
【问题描述】:
在日期选择器中选择日期时播放点击声音。现在我需要使用 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);
}
}
【问题讨论】:
标签: iphone xcode audio uiswitch