开发者

remote pinimage on an iphone mapview

开发者 https://www.devze.com 2023-03-04 04:29 出处:网络
i want to display remote images as pins on my map view i tried this way but this dont work a开发者_JAVA百科nnotationView.image = resizedImage;

i want to display remote images as pins on my map view i tried this way but this dont work

a开发者_JAVA百科nnotationView.image = resizedImage;
annotationView.opaque = NO;
UIImageView *sfIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"here the image URL"]];


imageNamed takes a file from your local application bundle.

You want:

UIImageView *sfIconView = [[UIImageView alloc] initWithImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:@"here is the image URL"]]];

I don't recommend doing it this way though because it'll block the main UI thread. You should consider loading the image data for your pin asynchronously first.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号