Reputation: 261
I have a root view that loads two view controller. e.g.:FirstVC
,SecondVC
.
I am showing FirstVC
as the root view controller when the app launches, on some action on FirstVC
I load SecondVC
by removing first.
For loading SecondVC
I first remove FirstVC
by
[FirstVCobj.view removeFromSuperView];
[FirstVCobj release];
FirstVCobj = nil;
After that I allocate and create SecondVC
Now only after calling SecondVC
's viewdidload()
is FirstVC
's dealloc()
method called.
Is this the right execution path, or is it due to some mistake I have made?
The above is exactly how I remove and create my view controllers.
Upvotes: 0
Views: 345
Reputation: 50129
i assume it is a UIView you're talking about.
to 'see' it: wrap it in a pool of your own
@autoreleasepool {
[FirstVCobj.view removeFromSuperView];
[FirstVCobj release];
FirstVCobj = nil;
}
Upvotes: 1
Reputation: 531
[FirstVCobj removeFromParentAndCleanup:YES];
Check with this might work.
Upvotes: 0