放大Mapview会崩溃iOS6上的应用程序

时间:2013-06-13 08:49:07

标签: xcode ios6 mkmapview zooming didreceivememorywarning

我正在使用mapview。当我在地图上放大时,它显示确实收到内存警告并在iOS 6设备中崩溃应用程序。但它在以下版本中正常工作。当我放大但它没有被释放如何释放它时它占用更多的内存我已经释放了释放方法中的所有对象,但它仍然显示相同的确实接收内存警告并崩溃应用程序 我的代码是

       mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
    mapView.showsUserLocation = YES;
    [mapView setDelegate:self];
    [self addSubview:mapView];
    routeView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, mapView.frame.size.width, mapView.frame.size.height)];
    routeView.userInteractionEnabled = NO;
    [mapView addSubview:routeView];

      - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
    {
       if([annotation isKindOfClass:[TurnAnnotation class]])
{
    MKAnnotationView *turnAnnotationView=[[MKAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:nil] ;
    turnAnnotationView.image=[UIImage imageNamed:@"TurnAnnotation1.png"];

    turnAnnotationView.canShowCallout=NO;
    return turnAnnotationView;
}
else if([annotation isKindOfClass:[PlaceMark class]])
{
    MKPinAnnotationView *newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:nil];

    if (isdefault==YES) {
        if(!appDel.appBOOL){
            newAnnotation.pinColor = MKPinAnnotationColorGreen;
            appDel.appBOOL = YES;
        }else {
            newAnnotation.pinColor = MKPinAnnotationColorRed;
            appDel.appBOOL = NO;
        }
    }else{


    if(!appDel.appBOOL){
        newAnnotation.pinColor = MKPinAnnotationColorRed;
        appDel.appBOOL = YES;
    }else {
        newAnnotation.pinColor = MKPinAnnotationColorGreen;
        appDel.appBOOL = NO;
    }
    }

    newAnnotation.canShowCallout = YES;

    return newAnnotation;
}
return nil;

}

1 个答案:

答案 0 :(得分:0)

难道你的iOS 6测试用例是Retina版吗? Retina图像占据了4倍的记忆。低内存警告不应该被忽略..