Iphone 地图套件用户位置(蓝点和圆圈)将不显示

Iphone 地图套件用户位置(蓝点和圆圈)将不显示,iphone,iphone-sdk-3.0,ios4,mapkit,android-mapview,Iphone,Iphone Sdk 3.0,Ios4,Mapkit,Android Mapview,我不明白为什么当前位置圆圈不会出现。我有自定义注释,看起来很好。。。并且地图被带到用户的当前位置。。。但是,这个圆圈并没有出现 这是我的密码。提前谢谢 - (void)viewDidLoad { [super viewDidLoad]; locationManager = [[CLLocationManager alloc] init]; [locationManager setDelegate:self]; [locationManager setDesiredAccuracy

我不明白为什么当前位置圆圈不会出现。我有自定义注释,看起来很好。。。并且地图被带到用户的当前位置。。。但是,这个圆圈并没有出现

这是我的密码。提前谢谢

- (void)viewDidLoad {
    [super viewDidLoad];

 locationManager = [[CLLocationManager alloc] init];
 [locationManager setDelegate:self];
 [locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
 [locationManager startUpdatingLocation];

 [mapView setMapType:MKMapTypeStandard];
 mapView.showsUserLocation = YES;

 MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
 region.span.longitudeDelta = 0.005;
 region.span.latitudeDelta = 0.005;
 [mapView setRegion:region animated:YES]; 
 [mapView setDelegate:self];
}

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation  {
    CLLocationCoordinate2D loc = [newLocation coordinate];
    [mapView setCenterCoordinate:loc];      
    }

-(MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation {
    static NSString *AnnotationViewID = @"annotationViewID";
    MKAnnotationView *annotationView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationViewID];

    if (annotationView == nil) {
        annotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationViewID] autorelease];
        }

    annotationView.canShowCallout = YES;

    if ([annotationView.annotation.title isEqualToString:@"One"]) {
        UIImage *pinImage = [UIImage imageNamed:@"one.png"];
        [annotationView setImage:pinImage];
    }

    if ([annotationView.annotation.title isEqualToString:@"Two"]) {
        UIImage *pinImage = [UIImage imageNamed:@"two.png"];
        [annotationView setImage:pinImage];
    }

    annotationView.annotation = annotation;
        return annotationView;

    }
-(void)viewDidLoad{
[超级视图下载];
locationManager=[[CLLocationManager alloc]init];
[locationManager设置代理:self];
[locationManager设置了所需的准确性:KCallocationAccuracyBest];
[locationManager startUpdatingLocation];
[mapView setMapType:MKMapTypeStandard];
mapView.showsUserLocation=是;
MKCoordinateRegion={0.0,0.0},{0.0,0.0};
region.span.longitudeDelta=0.005;
region.span.latitudeDelta=0.005;
[地图视图设置区域:区域动画:是];
[mapView setDelegate:self];
}
-(void)locationManager:(CLLocationManager*)manager didUpdateToLocation:(CLLocation*)newLocation fromLocation:(CLLocation*)oldLocation{
CLLocationCoordinate2D loc=[新位置坐标];
[地图视图设置中心坐标:loc];
}
-(MKAnnotationView*)地图视图:(MKMapView*)地图视图注释:(id)注释{
静态NSString*AnnotationViewID=@“AnnotationViewID”;
MKAnnotationView*annotationView=(MKAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationViewID];
如果(注释视图==nil){
annotationView=[[MKAnnotationView alloc]initWithAnnotation:annotation重用标识符:AnnotationViewID]自动释放];
}
annotationView.canShowCallout=是;
如果([annotationView.annotation.title isEqualToString:@“一个”]){
UIImage*pinImage=[UIImage ImageName:@“one.png”];
[注释视图集图像:pinImage];
}
如果([annotationView.annotation.title isEqualToString:@“两个”]){
UIImage*pinImage=[UIImage ImageName:@“two.png”];
[注释视图集图像:pinImage];
}
annotationView.annotation=注释;
返回注释视图;
}

将其添加到viewForAnnotation方法的顶部:

if ([annotation isKindOfClass:[MKUserLocation class]])
    return nil;  //return nil to use default blue dot view

您是在设备上测试还是在模拟器中测试?在模拟器中,用户的位置始终位于加利福尼亚州库比蒂诺。显示您的viewForAnnotation方法。@ezekielDFM我正在使用设备和模拟器。用户位置也不会出现在Cupertino中@Abitobevious我更新了我原来的问题。@Anna Karenina在设备中,闪烁的圆圈没有出现,只是显示当前位置的蓝点,在模拟器中工作正常,所以请给我一些想法