0
這是到目前爲止我的代碼:目標C延時
- (IBAction) startApproximiteLevel:(id)sender {
[getBackgroundLevel startAnimation:self];
float sample1;
float sample2;
float sample3;
float sample4;
float sample5;
float finalSample;
float charlieSoundVolume = [charlieSoundLevel floatValue];
sample1 = charlieSoundVolume;
sleep(1)
sample2 = charlieSoundVolume;
sleep(1)
sample3 = charlieSoundVolume;
sleep(1)
sample4 = charlieSoundVolume;
sleep(1)
sample5 = charlieSoundVolume;
sleep(1);
finalSample = ((sample1 + sample2 + sample3 + sample4 + sample5)/5);
self.backgroundSoundChange.floatValue = finalSample;
[getBackgroundLevel stopAnimation:self];
}
但是,這將更新charlieSoundLevel停止我的代碼另一部分。任何想法如何做到這一點沒有睡眠()?
利亞
你能舉個例子嗎? – objectiveccoder001 2010-07-05 16:17:14
在某些時候,您需要能夠閱讀和理解文檔,而不是依賴其他人爲您編寫代碼。 – 2010-07-05 22:52:02
我做過了,我找不到任何有關使用「時間延遲」的信息。請有人張貼代碼。相信我,我不是一個懶鬼...... – objectiveccoder001 2010-07-06 00:16:39