I'm new on iOS development and i got a trouble want to ask you.
My purpose is show a view (not full screen) upon base view and still see a parent on the back outside the subview. So i added a subview (subclass of UIViewController) upon current viewController, then i do to open the subview:
AViewController *a = [[AViewController alloc] initWithNibName:nil bundle:nil];
[self.view addSubView:a.view];
[a release];
Here it works and show this subview as i expected. On this subview, i have close button to close this subview and do like this on subview:
- (IBAction)BackTouchUp:(id)sender
{
[self.view removeFromSuperview];
}
When i click to close button, i got an error EXC_BAD_ACCESS. When i remove [a release] command on the parent, it works, but there is a memory leak.
Can you please explain for me the cause of this error and how to resolve this case?