MKMapView ignores update of centerOffset in iOS 4(MKMapView 在 iOS 4 中忽略 centerOffset 的更新)
问题描述
我之前创建了一个自定义标注气泡作为 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 的更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MKMapView 在 iOS 4 中忽略 centerOffset 的更新
基础教程推荐
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01
- 如何使用 YouTube API V3? 2022-01-01
- 固定小数的Android Money Input 2022-01-01
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01
- LocationClient 与 LocationManager 2022-01-01
- :hover 状态不会在 iOS 上结束 2022-01-01
- Android文本颜色不会改变颜色 2022-01-01
