在iPhone中启动应用程序时,我仍然面临问题。
它显示了presentModelViewController的堆栈溢出流,因为我使用了许多viewcontroller,并从其他viewcontroller调用了同一个viewcontroller,但是它被终止了。这里显示的是我在整个程序中用于调用其他视图控制器的代码]
UV_AlarmAppDelegate *app7 = (UV_AlarmAppDelegate *)[[UIApplication sharedApplication]delegate];
[self presentModalViewController:app7.frmComparisionChartLink animated:YES];
[app7 release];
仍然释放指针,但我的应用仍然被终止。
您不应该释放应用程序委托。简而言之,除非您alloc
,copy
或retain
一个对象,否则不需要释放它。
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];
希望有帮助。