2013-11-22 57 views
2

我無法弄清楚如何將滴答聲添加到我以編程方式聲明的UIPickerView。在@package,UIPickerView的結構中,我找到了一個名爲「unsigned int soundsDisabled:1;」的成員變量但我似乎無法訪問它。如何以編程方式將聲音添加到UIPickerView

任何建議將不勝感激。

感謝,

瑞安黃

編輯一些代碼:

-(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]; 

}

+0

給出一些示例代碼 – codercat

+0

有一點蘋果默認設置應該改變。蘋果應該從應用商店中拒絕該應用。執行之前要小心蘋果應用程序商店的條款和條件 – codercat

回答

2

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

Mul timedia方法:

SystemSoundID soundID; 

    NSString *soundPath = [[NSBundle mainBundle] pathForResource:effectTitle ofType:@"caf"]; 
    NSURL *soundUrl = [NSURL fileURLWithPath:soundPath]; 

    AudioServicesCreateSystemSoundID ((CFURLRef)soundUrl, &soundID); 
    AudioServicesPlaySystemSound(soundID); 
+0

嗨iDev,你想在我的代碼中看到什麼?一切都工作正常,除了我不知道如何啓用聲音到我編程創建的UIPickerView。 – RyanCW

+0

@RyanCW如果您想使用多媒體方法,那麼沒有任何UIPickerView委託方法。 – codercat

+0

嗯你是什麼意思?我如何使用這種方法添加聲音到我的uipickerview – RyanCW

相關問題