When I use a
UIPopoverController and give it a contentViewController, I cannot seem to get the contentViewController to correctly be deallocated (as evidenced by the fact that the contentViewController.viewDidUnload is never getting called).
Code to create and display the popup:
PopupTestViewController *popupTest = [[PopupTestViewController alloc] initWithNibName:@"PopupTestViewController" bundle:nil]; popupTest.mainViewController = self; self.popoverController = [[UIPopoverController alloc] initWithContentViewController:popupTest]; self.popoverController.popoverContentSize = popupTest.view.frame.size; self.popoverController.delegate = self; [self.popoverController presentPopoverFromRect:button.frame inView:button.superview permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Now I am assuming that the
contentViewController (in the code above, this is
PopoverTestViewController) should be deallocated when the
UIPopoverController is closed (whether by clicking off of it, or be explicitly dismissing it). But
viewDidUnload is never called. I did notice, however, that if I define a dealloc method for
PopoverTestViewController, that is called appropriately.
So my question is: why is
viewDidUnload never getting called?
(And I'm using ARC).