MKMap工作不正确的iOS6的(MKMap works incorrect in iOs6)

2019-07-31 23:20发布

我有一个问题:我有当地图数据加载到地图视图就知道了。 我用下面的方法。

- (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView;
{
    //Some custom code if Map is loaded
}

苹果改变了地图和现在的方法被调用,但地图仍然加载。

你有什么想法?

Answer 1:

我已经固定它。 起初,我创建了一个功能与我的自定义代码

-(void)customCode(id)object
{
    MKMapView* mapView = (MKMapView *)object;
    ...
}

在功能mapViewDidFinishLoadingMap我设置

- (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView;
{

    CGFloat systemVersion = [[[ UIDevice currentDevice ] systemVersion ] floatValue ];

    if( systemVersion < 6 )
    {
        [self updateMap:mapView];
    }
    else
    {
        [self myMapViewDidFinishLoaded:mapView];
    }
}

-(void)onMapTimed:(id)mapView
{
    [self performSelectorOnMainThread:@selector(customCode:) withObject:((NSTimer*)mapView).userInfo waitUntilDone:NO];
    _mapTimer = nil;
}

-(void)myMapViewDidFinishLoaded:(id)mapView;
{
    if(_mapTimer)
    {
        [_mapTimer invalidate];
        [_mapTimer release];
        _mapTimer = nil;
    }
    _mapTimer = [NSTimer scheduledTimerWithTimeInterval:0.3 target:self selector:@selector(onMapTimed:) userInfo:mapView repeats:NO];

}

这个对我有用。



文章来源: MKMap works incorrect in iOs6