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 的更新
基础教程推荐
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01