我正在編寫一個ap,當您按下按鈕時,該按鈕應被禁用0-10秒之間的隨機時間量,然後該按鈕變爲活動再次。但是,當按鈕被禁用時,如果用戶點擊,則點擊似乎只是排隊等待按鈕被啓用,並且點擊將被處理。我將如何禁用和不排隊用戶點擊?目標c按鈕禁用隊列用戶觸摸ups
-(void)buttonPressed{
NSLog(@"Button pressed!");
button.userInteractionEnabled=false;
sleep(rand()%10);
[email protected]"button is enabled!";
button.userInteractionEnabled = true;
}
感謝,我會嘗試NSTimer! – Denis 2012-01-13 05:09:59