xjrad

about customViewForGraphic method

Discussion created by xjrad on Feb 12, 2012
Latest reply on Feb 24, 2012 by njarecha-esristaff
I am trying to custom a callout,here is my code:

- (UIView*) customViewForGraphic:   (AGSGraphic *)  graphic
      screenPoint:  (CGPoint)  screen
      mapPoint:  (AGSPoint *)  mapPoint{
NSMutableDictionary *graphicAttr = [graphic attributes];

GraphicDetailViewController *gdv = [[GraphicDetailViewController alloc] initWithAttr:graphicAttr];
gdv.tableView.frame = CGRectMake(screen.x, screen.y, 300, 200);
gdv.tableView.delegate = gdv;
return gdv.tableView;
}

when I compile and analyze,there is a object leak warning:"Object leaked: object allocated and stored into 'gdv' is not referenced later in this execution path and has a retain count of +1".so I use "autorelease" for gdv object,but when i flip the table in callout,the program crashed.the error is :"-[GraphicDetailViewController tableView:cellForRowAtIndexPath:]: message sent to deallocated instance 0x102d8f00"

how can i resolve this?thanks

Outcomes