2010-02-26 27 views
1

當我在iphone中啓動我的應用程序時,仍然遇到問題。由iPhone中的presentModelViewController溢出堆棧iphone

它顯示了由presentModelViewController bcoz我使用視圖控制器的數量和調用相同的viewcontroller從其他viewcontroller,但它被終止。在這裏我顯示的代碼,我在整個程序中調用其他視圖控制器

UV_AlarmAppDelegate *app7 = (UV_AlarmAppDelegate *)[[UIApplication sharedApplication]delegate]; 
[self presentModalViewController:app7.frmComparisionChartLink animated:YES]; 
[app7 release]; 

我仍然釋放指針,但仍然我的應用程序終止。我不知道該怎麼做。

請幫助我多謝提前致謝

+2

爲什麼在這個世界上你想要發佈應用程序委託? – 2010-02-26 16:25:38

回答

4

您不應該發佈應用程序委託。總之,除非你是alloccopyretain一個對象,你不需要釋放它。

1

Apple的文檔顯示modalPresentation是這樣完成的;

UIViewController *uiViewController = [[UIViewController alloc] initWithNibName:@"UIViewController" bundle:nil]; 
uiViewController.delegate = self; 

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:uiViewController]; 
[self presentModalViewController:navigationController animated:YES]; 
[navigationController release]; 
[uiViewController release]; 

希望有幫助。