English 中文(简体)
在3.2、4.0和4.0中,对MKMap的口吻不同。
原标题:An offscreen MKMapView behaves differently in 3.2, 4.0

在3.1中,我一直在使用“快车”MapView制作地图图象,在向用户介绍这些图像之前,我可以轮流、作物等等。 在3.2和4.0中,这种技术不再奏效。 这里有一些说明问题的法典,随后是我的理论。

     // create map view

     _mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, MAP_FRAME_SIZE, MAP_FRAME_SIZE)];
     _mapView.zoomEnabled = NO;   
     _mapView.scrollEnabled = NO;
     _mapView.delegate = self;    
     _mapView.mapType = MKMapTypeSatellite;

     // zoom in to something enough to fill the screen
     MKCoordinateRegion region;    
     CLLocationCoordinate2D center = {30.267222, -97.763889};

     region.center = center;    
     MKCoordinateSpan span = {0.1, 0.1 };    
     region.span = span;    
     _mapView.region = region;

     // set scrollview content size to full the imageView  
     _scrollView.contentSize = _imageView.frame.size;

     // force it to load

#ifndef __IPHONE_3_2

     // in 3.1 we can render to an offscreen context to force a load    
     UIGraphicsBeginImageContext(_mapView.frame.size);    
     [_mapView.layer renderInContext:UIGraphicsGetCurrentContext()];
     UIGraphicsEndImageContext();

#else

     // in 3.2 and above, the renderInContext trick doesn t work...    
     // this at least causes the map to render, but it s clipped to what appears to be    
     // the viewPort size, plus some padding    
     [self.view addSubview:_mapView];          

#endif

当该地图装满时,我 s弄该地图,在我的滚动概览中加以uff击。

- (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView {    
     NSLog(@"[MapBuilder] mapViewDidFinishLoadingMap");

     // render the map to a UIImage
     UIGraphicsBeginImageContext(mapView.bounds.size);

     // the first sub layer is just the map, the second is the google layer, this sublayer structure might change of course

     [[[mapView.layer sublayers] objectAtIndex:0] renderInContext:UIGraphicsGetCurrentContext()];

     // we are done with the mapView at this point, we need its ram!    
     _mapView.delegate = nil;     

     [_mapView release];
     [_mapView removeFromSuperview];    
     _mapView = nil;

     UIImage* mapImage = [UIGraphicsGetImageFromCurrentImageContext() retain];
     UIGraphicsEndImageContext();     

     _imageView.image = mapImage;
     [mapImage release], mapImage = nil;  
}

第一个问题是,在3.1中,使情况趋于一致将触发地图开始装载。 这在3.2、4.0中不再奏效。 我发现的唯一事情是暂时增加这一看法的地图(即使之可见)。 问题是,地图只给屏幕的可见区域加一点dding。 框架/限值是罚款,但似乎“有益”优化了装货,以限制在屏幕上或靠近屏幕上看到的碎片。

如何迫使地图满负荷的想法? 是否有其他问题?

问题回答

暂无回答




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签