UIPopoverController and memory management

    UIPopoverController *historyPop = [[UIPopoverController alloc] initWithContentViewController:nav];
    [nav release];
    [historyPop setPopoverContentSize:CGSizeMake(400, 500)];
    [historyPop presentPopoverFromRect:CGRectMake(button.frame.origin.x, button.frame.origin.y, button.frame.size.width, 5) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
    //[historyPop release];

This is my current code, however the Analyser says that the is probably a leak, which there is (as the release line is commented out). But if I uncomment the release line then the app crashes and says dealloc was reach on the popover while it is still visible, so when exactly should I be releasing the popover controller?

5
задан Jonathan. 7 December 2010 в 19:16
поделиться