Ios 在MKPinAnnotationView中显示UITableView

Ios 在MKPinAnnotationView中显示UITableView,ios,ios5,mkmapview,Ios,Ios5,Mkmapview,我试图在MKPinAnnotationView的标注内显示UITableView。我在脚本文件中添加了UITableViewController。我使用以下代码将leftAccessoryView分配给UITableView - (MKAnnotationView *)mapView:(MKMapView *)mv viewForAnnotation:(id < MKAnnotation >)annotation { if([annotation isKindOfClass:

我试图在MKPinAnnotationView的标注内显示UITableView。我在脚本文件中添加了UITableViewController。我使用以下代码将leftAccessoryView分配给UITableView

- (MKAnnotationView *)mapView:(MKMapView *)mv viewForAnnotation:(id < MKAnnotation >)annotation
{
    if([annotation isKindOfClass:[MKUserLocation class]])
        return nil; 

    NSString *annotationIdentifier = @"ZillowPropertyDetailsIdentifier"; 

    MKPinAnnotationView *propertyDetailsView = (MKPinAnnotationView *) [mv 
                                                            dequeueReusableAnnotationViewWithIdentifier:annotationIdentifier];

    if (!propertyDetailsView) 
    {
        propertyDetailsView = [[MKPinAnnotationView alloc] 
                    initWithAnnotation:annotation 
                    reuseIdentifier:annotationIdentifier];

        // get view from storyboard 
        PropertyDetailsViewController *propertyDetailsViewController = (PropertyDetailsViewController *) [self.storyboard instantiateViewControllerWithIdentifier:@"PropertyDetailsIdentifier"];

        propertyDetailsView.leftCalloutAccessoryView = propertyDetailsViewController.view;

        [propertyDetailsView setPinColor:MKPinAnnotationColorGreen];
        propertyDetailsView.animatesDrop = YES; 
        propertyDetailsView.canShowCallout = YES; 

    }
    else 
    {
        propertyDetailsView.annotation = annotation;
    }

    return propertyDetailsView; 
}

当我点击pin时,它会崩溃,出现坏的异常或其他情况

您只有内存问题。当你这样做的时候

PropertyDetailsViewController *propertyDetailsViewController = (PropertyDetailsViewController *) [self.storyboard instantiateViewControllerWithIdentifier:@"PropertyDetailsIdentifier"];
返回一个自动释放的属性跟踪视图控制器。稍后,您只需将其视图命名为callout附件视图,但没有人保留视图控制器。方法完成时,viewcontrollers retain计数为零,并将其释放。当访问该视图控制器上的任何内容时,将引发一个错误的异常


实际上,坏_异常通常是一个内存问题(太多的释放、两个自动释放等),通过激活“启用僵尸对象”标志可以更好地跟踪它们。这使得对象无法完全解除分配,因此您可以看到哪个失败。

您的propertyDetailsViewController是否有效(非零),视图是否有效?propertyDetailsViewController是否有效,并且它位于情节提要中。我用PropertyDetailsViewController更新了代码。有几个方法可能是我们感兴趣的。让我尝试使用UIPopUPController并在其中显示tableview。是否可能您没有在任何地方实例化UITableView?实际上,我相信您无法在调用中显示UITableView。我需要关闭标注,然后显示弹出窗口,然后在弹出窗口内显示uitableview。
PropertyDetailsViewController *propertyDetailsViewController = (PropertyDetailsViewController *) [self.storyboard instantiateViewControllerWithIdentifier:@"PropertyDetailsIdentifier"];