I have invested days now, trying to understand what is happening, and for life I do not see what I am doing wrong. I display UIPopover when the user touches a point on the screen. The popover has a tab controller and a tabular view that displays information about this point. But when the popover is fired, it crashes, stating that: - [UIAnimator removeAnimationsForTarget:]: the message was sent to the freed instance
Here is the code loading the view controller:
MyViewController *popView = [[MyViewController alloc] init]; myPop = [[UIPopoverController alloc] initWithContentViewController:pop]; [popView release]; myPop.delegate = self; [airportPop setPopoverContentSize:popView.view.frame.size]; [airportPop presentPopoverFromRect:CGRectMake(location.x,location.y,1,1) inView:self.mainView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; - (void)dismissPopover { if( myPop != nil ) { [myPop dismissPopoverAnimated:YES]; [myPop.delegate popoverControllerDidDismissPopover:airportPop]; } } - (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController { [myPop release]; myPop = nil; }
The actual MyViewController is simply a UIViewController, which is short for init brevity:
- (id)init { self = [super init];
Dealloc is nothing more than [super dealloc], since everything essentially belongs to the view, and the view controller takes care of that. When myPop is released, in DidDismissPopover, the view is also released, so everything seems to be in order. But very soon after that I get a disaster.
Do I need to do something to drop the tab view or table view when the popup is rejected?
I use autorelease in cells in a table, should I stop doing this?
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
Thanks for any help !!! Any ideas are generally welcome!
Kevin