问题
I want to set a custom uiview with label outlets in my graph, if a plot symbol was pressed, using the scatterPlot:plotSymbolWasSelectedAtRecordIndex:
method.
But how can I give the plot area the UIView or how can I override CPTLayer to draw my custom UIView?
Thank you
回答1:
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.
来源:https://stackoverflow.com/questions/16302288/core-plot-framework-how-to-set-custom-uiview-in-cptplotspaceannotation