使用“弹出”在 MKMapView 中对 MKAnnotationView 的自定义标注进行动画处理影响

发布于 2024-08-11 22:46:23 字数 345 浏览 5 评论 0原文

我最终成功地组合了一个自定义标注 UIView,当点击 MKAnnotationView 时会显示该标注。我通过重写

- (void)setSelected:(BOOL)selected animated:(BOOL)animated;

我的自定义 MKAnnotationView 子类来做到这一点。注意:我通过将 canShowCallout 属性设置为 NO 来阻止主标注的显示。

我想尝试复制标准标注使用的动画......它似乎冒泡 - 比预期大一点,然后回到正常大小。到目前为止,我似乎对如何用核心动画制作类似的动画感到不知所措。有人有任何建议或指示吗?

提前致谢!

I finally managed to put together a custom callout UIView that gets shown when a MKAnnotationView is tapped. I did this by overriding

- (void)setSelected:(BOOL)selected animated:(BOOL)animated;

in my custom MKAnnotationView subclass. Note: I prevented the main callout from showing by setting the canShowCallout property to NO.

I'd like to try and replicate the animation that the standard callout uses... It seems to bubble up -- going a little bigger than intended, and then back to it's normal size. So far, I seem to be at a loss trying to figure out how to produce a similar animation with core animation. Anyone have any suggestions or pointers?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

云淡风轻 2024-08-18 22:46:23

我开发了一个自定义标注气泡,它与系统标注气泡几乎相同,但在高度和内容上提供了更大的灵活性。请参阅我在异步解决方案博客 例如代码。它还详细介绍了使用核心动画对标注进行动画处理的步骤,以便它看起来从地图图钉中弹出。它涉及缩放和平移视图的仿射变换。

I have developed a custom callout bubble that is nearly identical to the system callout bubble, but gives more flexibility over the height and content. See my post on the Asynchrony Solutions blog for example code. It also details the steps to animate the callout using Core Animation so that it appears to pop out of the map pin. It involves an affine transform that scales and translates the view.

孤独岁月 2024-08-18 22:46:23

我为此找到了一个不错的解决方案。 ftutils 库 提供了弹出动画。调用起来也很简单:

#import "FTAnimation.h"

[self.viewToAnimate popIn:.4 delegate:nil];

I found a decent solution for this one. The ftutils library provides a pop in animation. It's really easy to call too:

#import "FTAnimation.h"

[self.viewToAnimate popIn:.4 delegate:nil];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文