當使用UITabBarController時,當用戶在View1上輸入一些數據並按下按鈕時,我需要執行一些計算並在View2上顯示結果。我有一個AppDelegate,View1Controller,View2Controller和View3Controller(View3是一個基本上靜態的視圖)。我有一個AppDelegate,View1Controller,View2Controller和View3Controller(View3是一個基本上靜態的視圖)。我的AppDelgate聲明UITabBarController * rootController;當使用UITabBarController時強制從按鈕查看更改
在View1上,我的計算是在buttonPressed的IBAction中執行的;但是,我似乎無法強制視圖以編程方式切換到View2。
我已經做了很多搜索類似的問題,並認爲我應該做一些像「self.rootController.selectedIndex = 1」;然而,當我從我的View1Controller的buttonPressed中執行此操作時,出現錯誤「請求成員rootController的某些內容不在結構或聯合中」。
我想我在這裏錯過了一些基本的東西......可能需要用我的AppDelegate做些事情,但我把頭撞在牆上。
任何人都可以在這種情況下提供一些指導...就像我應該在View1Controller頭和參考我的AppDelgate的實現中做的關鍵事情?謝謝!