简体   繁体   中英

iOS MapBox Callout offset not working, callout always appear at the same height

It seems that despite me providing a value in the offset property for the callout, it still appears at exactly the same position. This position is a little too high above the flag images that I am displaying.

UIImage *markerImage = [UIImage imageNamed:@"Flag.png"]; marker = [[RMMarker alloc] initWithUIImage:markerImage anchorPoint:CGPointMake(0.45, 0.9)];

marker.calloutOffset = CGPointMake(0, 0.5);

//also tried
[marker setCalloutOffset:CGPointMake(0, 0.5)];

marker.canShowCallout = YES;

marker.delegate = self;

This is because unlike anchor points in MapBox iOS SDK, callout offset is absolute value, for example if you want to show callout offset at 28 pixels above the the anchor point, you have to set: marker.calloutOffset=CGPointMake(0, 28);

if that didn't help, try setting marker.contentsCenter too.

Hope it helps ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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