I have navigation based template, using core data(not sure if that matters), and a UIViewController as a second view. I get to the second view by clicking the add (+) button in the top right of the navigation bar. In here I have the top right button of the navigation controller call my save method when clicked. In this save method I create a RootViewController object and call one of the rootView's methods and then pop back to the root view.
The issue is that if I release this root view object the app crashes, if I do not release the object it seems to work fine. I just need to know if this is causing a memory leak?
Here is the code for the save method, this is in my UIViewController, the RootViewController is a UITableViewController:
I feel like the rvc object is now considered self since I have popped back to its view, and thus may not need to be released. I don't know but would like to know for sure.
Thanks!!!
The issue is that if I release this root view object the app crashes, if I do not release the object it seems to work fine. I just need to know if this is causing a memory leak?
Here is the code for the save method, this is in my UIViewController, the RootViewController is a UITableViewController:
Code:
-(void) save{
if ([newEventName.text length]== 0) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Missing Event Name" message:@"Please enter an event name or Cancel." delegate:self cancelButtonTitle:@"DONE" otherButtonTitles:nil];
[alert show];
[alert release];
return;
}
eventDate = dateStartedPicked.date;
RootViewController *rvc =[[RootViewController alloc] initWithNibName:nil bundle:nil];
[rvc addEventName:newEventName.text eventDate:eventDate];
[self.navigationController popToRootViewControllerAnimated:YES];
// [rvc release]; <--- Dies here if released
}
I feel like the rvc object is now considered self since I have popped back to its view, and thus may not need to be released. I don't know but would like to know for sure.
Thanks!!!