2013-05-27 47 views
0

所以我有一個標籤欄應用程序與三個選項卡。在第二個選項卡中,我有一個加載另一個視圖的按鈕,其中兩個文本字段將其值傳遞到原始選項卡視圖中的兩個標籤中。當我點擊按鈕時,輸入我的值,然後單擊設置按鈕返回到原始視圖,標籤被更改,但標籤欄不加載。如何從不同視圖切換後加載標籤欄?當從標籤欄的翻轉側返回時,標籤欄不加載。 iOS

代碼時,在原來的標籤欄視圖按鈕被按下

TeamNameViewController *fvc = [self.storyboard instantiateViewControllerWithIdentifier:@"99"]; 

fvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 

[self presentViewController:fvc animated:YES completion:nil]; 

代碼回到標籤欄

SecondViewController *tempView = [self.storyboard instantiateViewControllerWithIdentifier:@"SecondViewControllerSB"]; 

tempView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 

[self presentViewController:tempView animated:YES completion:nil]; 

回答

0

簡短的回答是:你不知道。

presentViewCntroller:animated:completion以模態方式呈現目標視圖控制器。其他視圖仍然存在,您不需要再次實例化它們,您需要關閉模式視圖控制器。

您需要調用dismissViewController:animated:完成呈現視圖控制器(即調用presentViewController:animated:completion負責的視圖控制器)。

+0

我遇到的問題是當我dismissViewController,它不會傳遞我的數據。你會知道如何解散和傳遞數據嗎? – NickyMilton

+0

我通常會做的是讓主持人在解散視圖之前負責解壓。爲呈現視圖控制器提供一種完成活動的方法。當你完成所提出的VC呼叫時。演示者VC從.presentedViewController提取數據,然後解除它。 –