我正在使用一个非常标准的配方在我的iPhone应用程序中呈现ModalViewControllers,但是我遇到了配方被打破并且很困惑的情况。这是我(几乎总是)如何设置演示:EXEC_BAD_ACCESS当关闭ModalViewController
MatcherViewController *controller = [[MatcherViewController alloc] initWithNibName:@"MatcherView" bundle:nil];
[controller setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[controller setDelegate:self];
[self presentModalViewController:controller animated:YES];
[controller release];
这永远的伟大工程,直到我说一两件事的组合,我发信息给新的控制器对象之前,我提出它,像所以:
MatcherViewController *controller = [[MatcherViewController alloc] initWithNibName:@"MatcherView" bundle:nil];
[controller setPrimary:primaryIndex andSecondary:secondaryIndex];
[controller setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[controller setDelegate:self];
[self presentModalViewController:controller animated:YES];
[controller release];
添加此方法调用似乎工作,直到我解雇视图控制器......在这一点与EXEC_BAD_ACCESS信号的应用程序崩溃。如果我删除[controller release]
,我可以使用额外的线路工作,但是恐怕会导致泄漏。为什么在演示之前向对象发送消息的任何想法都会导致这种情况?有没有更好的方法将简单的参数传递给ModalViewController?
感谢您在理顺新手时,P
你在做什么-setPrimary:andSecondary:? – 2010-02-21 14:50:47
将参数(NSInteger)传递给成员变量。 – Devunwired 2010-02-21 15:58:28