2012-01-03 50 views
0

我想要顯示兩個圖像,一個接一個地右對齊;在用戶按下「開始」之後。第一幅圖像將顯示3秒,然後第二幅圖像將在右側顯示。每張圖像設置爲暫停3秒。它符合好了(3G 4.2.1)模擬器上模擬運行時,無論圖像的已被註釋掉,但是當編碼如下第一個圖像上掛起:顯示一個圖像,然後是第二個圖像iPhone上的用戶Preses「開始」之後的圖像

//this method gets called when the start button is pressed 
-(IBAction) start { 

    [self.navigationController pushViewController:self.**halfSplashController** animated:YES]; 

    [self.navigationController pushViewController:self.**halfSplash2Controller** animated:YES]; 
} 

有我需要之間插入一個命令這兩個或應該顯示第一個圖像,然後按照我的設想繼續第二個圖像?

回答

0

我認爲你應該使用NSTimer延遲3秒。試試下面的代碼

-(IBAction) start 
{ 
    [self.navigationController pushViewController:self.**halfSplashController** animated:YES]; 

    [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(theActionMethod) userInfo:nil repeats:NO]; 
    [currentTimer fire]; 
} 


- (void)theActionMethod 
{ 
    [self.navigationController pushViewController:self.**halfSplash2Controller** animated:YES]; 
} 

秒。如果你要反覆更改圖像,然後更改重複到YES在的NSTimer initialization.And也改變了代碼theActionMethod()函數它將改變3後的圖像。

+0

的方式。謝謝。 – user1127421 2012-01-04 03:18:30

0

您也可以使用該方法[自performSelector:afterDelay],它應該工作您的解決方案爲我工作很好,你想

+0

我不熟悉這種方法,我會檢查出來。謝謝。 – user1127421 2012-01-04 03:19:47

相關問題