如何使图形用户的坐标交互? [英] How to make the coordinate of a graph user interactive?

查看:49
本文介绍了如何使图形用户的坐标交互?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Quartz 2D绘制图形.它看起来更像一张图纸.但是我正在固定轴并根据轴绘制坐标.但是问题是我想让图形用户互动.图形上的每个坐标将进一步必须向下钻取以显示坐标的详细信息.那么如何使坐标互动.

I have tried to plot a graph using Quartz 2D . It looks more like a drawing. But I am fixing the axes and plotting the coordinates according to the axes. But the problem is I want to make the graph user interactive. Each coordinate on the graph will further have to drill down showing the details of the coordinate. So how can I make the coordinates interactive .

推荐答案

您可能不想看一下具有交互性的Quartz图,而是想看看

Rather than rolling your own Quartz graph with interactivity, you might want to take a look at the Core Plot framework, which is available for Mac and iPhone. The stubs are there to provide user interactivity, but we haven't filled in any implementations of this yet.

如果愿意,您可以实施

-(BOOL)containsPoint:(CGPoint)thePoint
-(void)mouseOrFingerDownAtPoint:(CGPoint)interactionPoint
-(void)mouseOrFingerUpAtPoint:(CGPoint)interactionPoint
-(void)mouseOrFingerDraggedAtPoint:(CGPoint)interactionPoint
-(void)mouseOrFingerCancelled

在适当的CPLayer子类中的

,以使Core Plot元素响应用户交互.我们还将建立一个委托模式,以便您的控制器也可以处理交互事件的逻辑.

within the appropriate CPLayer subclass to make that Core Plot element respond to user interaction. We will also be setting up a delegation pattern so that your controllers can handle the logic for interaction events as well.

这篇关于如何使图形用户的坐标交互?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆