问题描述
我之前创建了一个自定义标注气泡作为 MKAnnotationView 的子视图,因为内置标注非常有限.这需要我在选择 MKAnnotationView 以考虑标注气泡的大小时更改为 centerOffset.这一切都在 iOS 4 出现之前完美运行.现在,在 iOS 4 中,它完全忽略了我对 centerOffset 属性的更新,因此图钉和气泡似乎向下和向右跳(标注气泡的左上角现在位于图钉点应该在的位置).
I previously created a custom callout bubble as a subview to the MKAnnotationView because the built in callout is so limited. This requires me to change to centerOffset of the MKAnnotationView when it is selected to account for the size of the callout bubble. This all worked perfectly before iOS 4 came out. Now, with iOS 4, it completely ignores my updating of the centerOffset property and therefore the pin and bubble appear to jump down and to the right (the top left corner of the callout bubble is now at the location where the pin point should be).
有谁知道为什么这在 iOS 4 中发生了变化?我可以做些什么来让 MKMapView 识别新的 centerOffset?这是苹果引入的bug吗?
Does anyone know why this has changed in iOS 4? Is there something I can do to get the MKMapView to recognize the new centerOffset? Is this a bug that apple introduced?
感谢您的帮助!
推荐答案
确保您使用的是 MKAnnotationView 而不是 MKPinAnnotationView!您不能设置 MKPinAnnotationView 对象的 centerOffset(当然,除非您是子类).
Make sure you are using MKAnnotationView and not MKPinAnnotationView! You can't set the centerOffset of a MKPinAnnotationView-object (except if you subclass of course).
这篇关于MKMapView 在 iOS 4 中忽略 centerOffset 的更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!