简体   繁体   English

使用Mapkit时,我可以看到完全可滚动的地图,但是没有Apple总部?

[英]In using the Mapkit, I can see the fully scrollable map however no Apple headquarters?

I have tried it both on an actual device (iPad) and the iPhone simulator (ios 4) 我已经在实际设备(iPad)和iPhone模拟器(ios 4)上都尝试过

I see the map but no Apple headquarters (blue pin) even if I zoom in. 即使放大地图,我也看不到地图,但没有看到苹果总部(蓝色图钉)。

In my OnViewLoad function I have: 在我的OnViewLoad函数中,我有:

mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];

mapView.showsUserLocation=TRUE;
mapView.mapType=MKMapTypeHybrid;

[self.view insertSubview:mapView atIndex:0];

In your -mapView:viewForAnnotation: method, return nil if the annotation is a userLocation object: -mapView:viewForAnnotation:方法中,如果注释是userLocation对象,则返回nil:

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
    if ([annotation isMemberOfClass:[MKUserLocation class]]) {
        return nil;
    }
    // your normal code
}

This is needed to make sure, the iOS default implementation is used to show the blue userLocation dot. 需要确保使用iOS默认实现来显示蓝色的userLocation点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM