GMSMarker图标被忽略

时间:2013-07-18 13:13:22

标签: ios google-maps-markers google-maps-sdk-ios

我最近更新到最新的谷歌地图sdk for ios(1.4),我有一个自定义标记,我用作群集标记,并显示该标记内的标记数量。

- (UIImage *)icon {

UIImage *img = [UIImage imageNamed:DEFAULT_ICON];
NSString *text = [NSString stringWithFormat:@"%d",[self.markersInCluster count]];

UIFont *font = [UIFont boldSystemFontOfSize:14];
CGSize textSize = [text sizeWithFont:font];

CGPoint point = CGPointMake((img.size.width - textSize.width) /2, (img.size.height - textSize.height) /2);

UIGraphicsBeginImageContext(img.size);
[img drawInRect:CGRectMake(0,0,img.size.width,img.size.height)];
CGRect rect = CGRectMake(point.x, point.y, img.size.width, img.size.height);
[[UIColor whiteColor] set];
[text drawInRect:CGRectIntegral(rect) withFont:font];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

return newImage;

}

在升级之前它应该正常工作,现在它似乎只渲染图像,如果在GMSMarker init上更改了此图标属性,否则它会显示默认标记。

0 个答案:

没有答案