0在10秒內有一個標籤,該標籤顯示得分爲10000〜0 10秒(lblPoints)更新一個標籤,顯示10000使用的NSTimer
NSTimer pointstimer=[[NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(pointstimermethod) userInfo:nil repeats:YES]retain];
-(void)pointstimermethod
{
points=points-1;
lblPoints.text=[NSString stringWithFormat:@"%d",points];
}
誰能告訴我怎麼可以顯示10000〜 0準確而精確地10秒?
我想這不會工作!因爲你的建議10.0爲間隔。因爲它每10秒只會減少-1。它反對質疑。你應該更新你的答案。 – Hemang
這將調用方法pointstimermethod每10秒,我想調用這個方法faslty,它可以在10秒內顯示10000到0 – Anand
嘿夥計在scheduledTimerWithTimeInterval這裏:10.0你定義秒爲10.0如果你想快速然後descrese它與1.0像scheduledTimerWithTimeInterval:1.0 –