我无法显示标记的信息窗口,但是在加载地图时甚至不点击标记就可以显示信息吗?
答案 0 :(得分:0)
好的,因为默认情况下Google地图当前不提供此功能,因此可以解决此问题。创建标记时,请按以下步骤操作:
首先,您创建一个视图,并向其中添加标签和图像。
interface ILog
{
}
class ConsoleLog: ILog
{
}
然后创建一个标记,并为其分配上方视图的图像:
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 20)];
// Set label properties as required including marker Name
UIImageView *markerIconImageView = [[UIImageView alloc]initWithFrame:CGRectMake(35, 10, 30, 50)];
// Set image properties as required including image which will be displayed as marker
UIView *markerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
[markerView addSubview:label];
[markerView addSubview:markerIconImageView];
作为参考,这是我将视图转换为图像的功能:
GMSMarker *marker = [[GMSMarker alloc] init];
marker.icon = [self imageWithView:markerView];
marker.position = coordinates for marker;
marker.appearAnimation = kGMSMarkerAnimationPop;
marker.map = your map;
因为,我们已将视图转换为图像。它占用的内存空间更少。
希望这会有所帮助。并为您提供了一种方法。