我已經閱讀了所有其他用戶對問題的描述,但他們似乎沒有得出適用於我的結果,或者他們以'我修復了它們 - 感謝您的幫助'而結束了,但之後他們忽略了分享其解決方案。這裏是我的代碼來呈現和解僱(所有的關鍵對象是我的應用程序委託的屬性,我試圖調出一個關於頁面,然後返回到應用程序,我做了什麼錯誤??dismissModalViewControllerAnimated:不會關閉頁面嗎?
當前模態VC作品):
-(IBAction) showInfoButton: (id) sender {
NSLog(@"%s", __FUNCTION__);
if(aboutViewController == nil) {
aboutViewController = [[[AboutViewController alloc] initWithNibName:@"About" bundle:[NSBundle mainBundle]] autorelease];
[appDelegate.window addSubview: aboutViewController.view];
}
appDelegate.modalNavigationController = [[UINavigationController alloc] initWithRootViewController:aboutViewController];
[appDelegate.modalNavigationController presentModalViewController:appDelegate.modalNavigationController animated: YES];
}
我從關於視圖控制器辭退(不工作):
-(IBAction) dismissAbout: (id) sender {
NSLog(@"%s", __FUNCTION__);
[self dismissModalViewControllerAnimated:YES];
}
我已經嘗試過動畫'NO',但是沒有任何區別。我試圖將我的代碼與其他代碼進行匹配,但這沒有任何區別。我正在轉圈,所以任何幫助表示讚賞。
謝謝艾康。您的回覆看起來像是正確的答案,但我必須將我的代碼全部頂起來,以至於無法像您所說的那樣簡單地使其工作。我會重構我的代碼(即從頭開始:)),當我得到它的工作時,我會標記你的答案。 – mobibob 2009-12-09 03:52:48
我已經差不多了......我有導航到/從,但它不是模態。今晚,我應該完成這個併發布我的新知識。 – mobibob 2009-12-09 14:34:34
好的。我按照Ican的建議閱讀了文檔(再次),並且引發我關注的是關於「loadView」方法的聲明。只要我把這些知識放在頭腦中,並且知道我已經完成了關於我的關於頁面視圖的「addSubview」,我意識到我需要一個「removeSubview」類。我發現在附加代碼 - (IBAction)解僱關於:(id)發件人{ \t NSLog(@「%s」,__FUNCTION__); \t \t [self.view removeFromSuperview]; \t [self dismissModalViewControllerAnimated:YES]; } Ican,你會得到答案複選標記。謝謝! – mobibob 2009-12-11 04:35:06