我試圖從另一個視圖控制器加載一個臨時的幻燈片視圖。我的應用程序的視圖控制器結構:使用'presentModalViewController'加載視圖
Application > Tab Bar Controller > TabBarItem > View Controller
在這個視圖控制器,我有一個按鈕,成功觸發一個方法來加載臨時視圖:
- (IBAction)displayTimePickerViewForDayButton:(id)sender {
NSLog(@"displayTimePickerViewForDayButton method entered.");
// create the selector view controller and become the delegate
WOTimePickerViewController *tpvc = [[WOTimePickerViewController alloc] initWithNibName:@"WOTimePickerView" bundle:nil];
tpvc.delegate = self;
tpvc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:tpvc animated:YES];
[tpvc release];
}
我已經驗證了我的WOTimePickerViewController成功返回從init方法,但視圖永遠不會輸入它的viewDidLoad方法。
所以,如果我看看IB的視圖,它似乎連接到vc的「視圖」屬性。當我在模擬器(從IB)中運行視圖時,它可以正確渲染。
當我從XCODE運行應用程序時,我可以導航到視圖,單擊我的按鈕,並出現一個空白的白色屏幕(注意,這不是應加載的視圖的白色背景)。
建設的問題?也許你可以嘗試刪除項目目錄中的'build'目錄,然後再使用Xcode進行編譯。所有的資源應該在那時正確地更新。 – Joost 2009-11-29 10:08:26