开发者

MapKit MapView Annotations overlapping on a real device

开发者 https://www.devze.com 2023-02-28 16:13 出处:网络
I have开发者_运维知识库 the problem depicted in the image when testing my app on a real device (iPhone 3G, 3.1.3).

I have开发者_运维知识库 the problem depicted in the image when testing my app on a real device (iPhone 3G, 3.1.3). It is fine in the simulator (xcode 3 with ios 4.1 sdk). sorry, can't post images yet, this is my first question here.

http://i.stack.imgur.com/Ct4on.jpg

I have the following code in the implementation of the annotation:

- (id)initWithLocation:(CLLocationCoordinate2D)coord {
self = [super init];
if (self) {
    coordinate = coord;
}
return self;
}

And this is part of the header file:

@interface MyAnnotation : NSObject <MKAnnotation>

And this is where I create a new one (inside a loop):

MyAnnotation *theAnnotation = [[MyAnnotation alloc]  initWithLocation:theCoordinate];
theAnnotation.title = [single objectForKey:@"address"];
theAnnotation.objID = [single objectForKey:@"id"];

[self.mapView addAnnotation:theAnnotation];
[theAnnotation release];

Any ideas about this? I don't know what to look :/


You could try to bring the (annotation)view to the front, when tapping on it.

So, when someone taps on an annotation, you should call [[self superview] bringSubviewToFront:self];

Best, Christian

0

精彩评论

暂无评论...
验证码 换一张
取 消