如何以编程方式将声音添加到UIPickerView



我不知道如何将滴答声添加到我以编程方式声明的UIPickerView中。在@package,UIPickerView的结构中,我发现了一个名为"unsigned int soundsDisabled:1;"的成员变量,但我似乎无法访问它。

如有任何建议,我们将不胜感激。

谢谢,

Ryan Wong

编辑一些COde:

-(void)initializeGame {
self.startTime = [NSDate date]; // Load the current time into startTime...
// create UIPickerView
UIPickerView *myPickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 650, 768, 216)];
myPickerView.delegate = self;
myPickerView.showsSelectionIndicator = YES;
[self.view addSubview:myPickerView];
[self resetStats];

}

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator 5.0.sdk/System/Library/Frameworks/UIKit.framework/scrollerClick.wav

多媒体方法:

SystemSoundID soundID;
    NSString *soundPath = [[NSBundle mainBundle] pathForResource:effectTitle ofType:@"caf"];
    NSURL *soundUrl = [NSURL fileURLWithPath:soundPath];
    AudioServicesCreateSystemSoundID ((CFURLRef)soundUrl, &soundID);
    AudioServicesPlaySystemSound(soundID);  

最新更新