gpt4 book ai didi

ios - 在自定义注释之上显示用户个人资料图像

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:21:56 26 4
gpt4 key购买 nike

我能够添加自定义注释图像来替换默认标记,但我不知道如何在其上添加用户图像。我需要从 URL 加载用户图像。

附注我需要一个 iOS 7 解决方案。

这基本上是我想要实现的(取自另一个应用程序):

enter image description here

最佳答案

想通了:

添加了一个 UIImageView 作为 MKAnnotationView 的 subview :

MKAnnotationView *pinView = (MKAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:@"CustomPinAnnotationView"];
pinView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"CustomPinAnnotationView"];
pinView.canShowCallout = YES;
pinView.image = [UIImage imageNamed:@"icon-map-placemark-68x80"];
pinView.calloutOffset = CGPointMake(0, -5);

UIImageView *profileImageView = [[UIImageView alloc]init];
profileImageView.frame = CGRectMake(6, 7, 55, 55);
profileImageView.layer.masksToBounds = YES;
profileImageView.layer.cornerRadius = 27;
[profileImageView setImageWithURL:[NSURL URLWithString:@"http://domain.com/avatar.jpg"]];

[pinView addSubview:profileImageView];

附注为了显示来自 URL 的图像,我使用了 SDWebImage/UIImageView+WebCache.h 类别。

关于ios - 在自定义注释之上显示用户个人资料图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25014576/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com