iOS 11 - 映射群集注释图标大小行为

时间:2017-12-01 11:36:34

标签: ios objective-c mkmapview ios11

是否有任何方法可以将大注释调整为与左边注释相同。它是 iOS11 行为,我想要像之前所有注释的唯一大小。

enter image description here

提前致谢

1 个答案:

答案 0 :(得分:0)

这就是我为我的项目所做的事情

委托方法

- (MKAnnotationView *) mapView:(MKMapView *)mapView1 viewForAnnotation:(id <MKAnnotation>) annotation

1)创建注释视图

MKAnnotationView *annView = [[MKAnnotationView alloc] initWithAnnotation:currentAnnotation reuseIdentifier:@"Cluster"];

2)设置框架和其他属性

[annView setFrame:CGRectMake(0, 0,100,100)]; //(Important)
annView.canShowCallout = YES;
[annView setCenterOffset:CGPointMake(0, -18)];

3)将图像视图添加为具有相同帧大小的子视图

UIImageView *homeImage = [[UIImageView alloc] initWithImage:[UIImage cachedImage:@"GroupPin"]];
[homeImage setFrame:CGRectMake(0, 0,100,100)]; //(Important)
[annView addSubview:homeImage];
return annView;

你已经完成了。