非常感謝回覆。在這裏,我實現了「NSTimer」概念,而不是使用「PerformSelector:afterDelay」。這裏的代碼,
timer = [NSTimer scheduledTimerWithTimeInterval: 5.0
target: self
selector: @selector(goToNextView)
userInfo: nil
repeats: NO];
// here i have set the time interval of '5.0' and after that taking into next view.
-(void)goToNextView
{
newtest15 *nt=[[newtest15 alloc]init];
[self.navigationController pushViewController:nt animated:YES];
}
而且我有工具欄上的按鈕,也用於導航到下一個視圖。
-(IBAction)btn:(id)sender{
if ([timer isValid])
{
[timer invalidate], timer=nil;
}
newtest15 *nt=[[newtest15 alloc]init];
[self.navigationController pushViewController:nt animated:YES];
}
/* here, when the user wants to move to next view before the time interval of '5', and presses the button at the bottom, this action will be performed, it will invalidate the timer and navigate to the next view*/
感謝您的回答。我問,如果用戶在(0.5)秒之前點擊按鈕,(按鈕)動作應該發生,而不是(afterDelay)功能。 – jireh
您可能已經看到圖像在各種網站中移動,在特定的時間間隔內會發生變化,並且您觀察到圖像下方出現「導航點」,如果用戶單擊第三個點,圖像視圖將顯示。類似的事情,我問,但在iPhone。 – jireh