核心图框架-如何在CPTPlotSpaceAnnotation中设置自定义UIView [英] core plot Framework - How to set custom UIView in CPTPlotSpaceAnnotation

查看:89
本文介绍了核心图框架-如何在CPTPlotSpaceAnnotation中设置自定义UIView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果要按下图形符号,我想使用 scatterPlot:plotSymbolWasSelectedAtRecordIndex:方法在图形中设置带有标签出口的自定义uiview。

I want to set a custom uiview with label outlets in my graph, if a plot symbol was pressed, using the scatterPlot:plotSymbolWasSelectedAtRecordIndex: method.

但是我如何给绘图区域UIView或如何重写CPTLayer来绘制我的自定义UIView?

But how can I give the plot area the UIView or how can I override CPTLayer to draw my custom UIView?

谢谢

推荐答案

CPTLayer CALayer ,因此您不能仅将自定义 UIView 用作核心图注释。但是,您可以将自定义视图作为Core Plot托管视图(不是子视图!)的同级插入。使用绘图空间获取绘图区域中触摸数据点的坐标,并使用内置的 CALayer 方法将坐标从绘图区域图层转换为图形层。

CPTLayer is a subclass of CALayer, so you can't just use the custom UIView as a Core Plot annotation. However, you could insert your custom view as a sibling of the Core Plot hosting view (not a subview!). Use the plot space to get the coordinates of the touched data point in the plot area and use the built-in CALayer methods to convert the coordinates from the plot area layer to the graph layer.

这篇关于核心图框架-如何在CPTPlotSpaceAnnotation中设置自定义UIView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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