I am new to the iPhone SDK and I got a leak on a navigation controller.
Here is my code :
-(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];
}
}
I am getting leaks on these lines:
[self.navigationController pushViewController:obj_SignUpViewController animated:YES];
[self.navigationController pushViewController:obj_SignUpViewController animated:YES];
Please help me…
Thank you…
When you push a view controller onto a navigation controller, it gets retained. Therefore, you need to release it right afterwards or you will get a leak.