0

我是 iPhone SDK 的新手,我在导航控制器上遇到了漏洞。这是我的代码:

-(void)SignupClicked:(id)sender {

if(appdelegate.isiPad){
    SignUpViewController *obj_SignUpViewController =[[SignUpViewController alloc] initWithNibName:@"SignUpViewControllerIpad" bundle:nil];
    [self.navigationController pushViewController:obj_SignUpViewController animated:YES];
    [obj_SignUpViewController release];
}
else {
    SignUpViewController *obj_SignUpViewController =[[SignUpViewController alloc] initWithNibName:@"SignUpViewController" bundle:nil];
    [self.navigationController pushViewController:obj_SignUpViewController animated:YES];
    [obj_SignUpViewController release];
}

}

我在这些方面有泄漏:

[self.navigationController pushViewController:obj_SignUpViewController animated:YES];
[self.navigationController pushViewController:obj_SignUpViewController animated:YES];

请帮助我...谢谢...

4

1 回答 1

2

当您将视图控制器推送到导航控制器时,它会被保留。因此,您需要在之后立即释放它,否则您会泄漏。

[obj_SignUpViewController release];
于 2012-05-22T05:58:49.713 回答