2014-04-12 104 views
0

我在ios應用程序中有四個選項卡。我想從視圖加載顯示圖像預覽。我該如何解決它?在頁面加載之前顯示圖像

+0

這不是從你的問題不清楚是什麼你正在嘗試做的。請提供更多信息。 –

+0

@ZevEisenberg我想在viewload之前顯示圖像。但我想每次都顯示。像啓動畫面一樣。 – user3503824

+0

您的意思是,當您切換標籤時,它會在顯示標籤內容之前顯示圖像? –

回答

0

-viewWillAppear:中,顯示您的圖像。然後在-viewDidAppear:中使用dispatch_after塊來延遲設置其餘的用戶界面。

- (void)viewWillAppear:(BOOL)animated 
{ 
    [super viewWillAppear:animated]; 
    self.imageView.image = [UIImage imageNamed:@"myImageName"]; 
} 

- (void)viewDidAppear:(BOOL)animated 
{ 
    [super viewDidAppear:animated]; 
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(myDelayInSeconds * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 
     // Code to animate removal the image view, 
     // adding new views, or whatever else you need to do here 
    }); 
} 
+0

你能舉個例子嗎?我不明白。 – user3503824

+0

我調整了我的答案並添加了一個例子。 –

+0

謝謝你的幫助。 – user3503824

相關問題