[英]Try to have a UIImage in a MKAnnotation
I try to have a UIImage in a MKAnnotation: 我尝试在MKAnnotation中有一个UIImage:
UIView *leftCAV = [[UIView alloc] initWithFrame:CGRectMake(0,0,32,32)];
leftCAV.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"..."]];
pin.leftCalloutAccessoryView = leftCAV;
The code is run, but I don't have a transparent background 代码已运行,但我没有透明背景
See that: 看到:
http://img19.imageshack.us/f/1234wr.png/ http://img19.imageshack.us/f/1234wr.png/
Have an idea? 有想法吗?
thanks :) 谢谢 :)
Any reason not just using an imageView? 有什么原因不只是使用imageView吗?
UIImageView *iconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Location.png"]];
annotationView.leftCalloutAccessoryView = iconView;
Did you try: 你试过了吗:
leftCAV.backgroundColor = [UIColor clearColor];
? ?
I'll assume your image is 32x32. 我假设您的图片是32x32。 Does it have a transparent background? 它具有透明背景吗? (I could not tell if what I was looking at at the link you provided was what you intended. There's too much going on on that site! :-) (我无法确定我在查看您提供的链接时是否符合您的意图。该网站上发生的事情太多了!:-)
Add this leftCAV.opaque=NO;
添加此leftCAV.opaque=NO;
. 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.