2012-02-01 37 views
0

我有一個問題及時將變量傳遞給視圖。將變量傳遞給在TabBar中調用的視圖

我有三個觀點:

ListagemReceitas - 景觀帶的TableView

BlocoReceita - 景觀帶的TabBar

CapaReceita - 查看與要顯示

數據流程是這樣的:

  • 在的tableView的點擊我調用視圖ListagemReceitas BlocoReceita
  • 其連接的TabBar的第1項,並且每當視圖BlocoReceita被調用時顯示的視圖CapaReceita,需要接收一個變量的視圖定位要顯示的信息;

當我致電鑑於BlocoReceita的tableView ListagemReceitas的點擊來看,我直接去查看CapaReceita變量與下面的代碼:

加載視圖
Receita_Capa_iPhone detailViewController = * [[Receita_Capa_iPhone alloc] initWithNibName: @ "Receita_Capa_iPhone" bundle: nil]; 
NSDictionary * dict = [arrCanapes objectAtIndex: indexPath.row]; 
[detailViewController setCodigo: [dict objectForKey: @ "code"]]; 

只有當CapaReceita(viewWillAppear中),數據被檢索爲空。

我試着通過代碼來查看BlocoReceita,它viewWillAppear通過代碼來查看CapaReceita,但無濟於事。

我直接點擊查看CapaReceita tableView ListagemReceitas進行測試調用,然後工作。但是當我調用這個視圖並且BlocoReceita CapaReceita自動加載視圖時,那麼數據就是無效的。

有人能告訴我什麼可能是錯的?如果你有任何具體的方法呢?

我調用視圖BlocoReceita與代碼「 pushViewController」

[self.navigationController presentModalViewController: receitaViewController animated: YES]; 

因爲它有一個的TabBar獨立的TabBar ListagemReceitas觀點,不給用做

回答

0

把一個的NSLog語句後:

的NSDictionary *字典= [arrCanapes objectAtIndex:indexPath.row]; NSLog(@「dict =%@」,dict); //添加這個

我打賭你會發現字典沒有正確實例化。